mouse_callback(3alleg4)

πŸ’– NAME πŸ’–

mouse_callback β€” the user specified mouse callback, bestie. It's part of the Allegro game programming library. ✨


🌸 SYNOPSIS 🌸

#include <allegro.h>

extern void (*mouse_callback)(int flags);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen. This function gets called by the interrupt handler whenever the mouse moves or whenever one of the buttons changes state. That's it, that's the whole job. πŸ­πŸ’…

🚨 MAJOR WARNING BESTIE 🚨 This function must be in locked memory, and it must execute _very_ quickly! Like, blink-and-you-miss-it fast. No cap. Do not be doing cute little side quests in here. 😭

It gets passed the event flags that triggered the call β€” that's a bitmask, and it can contain any of these:

  • MOUSE_FLAG_MOVE
  • MOUSE_FLAG_LEFT_DOWN
  • MOUSE_FLAG_LEFT_UP
  • MOUSE_FLAG_RIGHT_DOWN
  • MOUSE_FLAG_RIGHT_UP
  • MOUSE_FLAG_MIDDLE_DOWN
  • MOUSE_FLAG_MIDDLE_UP
  • MOUSE_FLAG_MOVE_Z

and that's the whole list, periodt. πŸ‘‘

πŸ™ˆ lowkey important heads up: even if the mouse has more than three buttons, only the first three can be trapped using a callback. The rest? Not invited to the party. πŸ’€

πŸŽ€ SEE ALSO πŸŽ€


mwah πŸ’‹ this page came to you from Allegro version 4.4.3 β€” that's the manual page mouse_callback(3alleg4), and yes she ate. πŸŒˆβ­πŸ‘‘