mouse_callback(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– mouse_callback(3) πŸ’–

okay bestie, so this is a page from the Allegro manual (the game programming library, yes THAT Allegro) and it's about mouse_callback β€” a lil function pointer you get to fill in yourself. group chat, gather round 🫢


✨ NAME ✨

mouse_callback β€” the mouse callback that you specify. it's part of the Allegro game programming library, and it is exactly as niche and exactly as powerful as it sounds πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

extern void (*mouse_callback)(int flags);

that's it. that's the whole thing. a function pointer just vibing out there in the open, waiting for you to point it at something 😌


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: the interrupt handler calls this thing whenever the mouse moves or whenever one of the buttons changes state. that's the whole job description.

🚨 TWO HARD RULES, no cap: this function must live in locked memory, and it must execute _very_ quickly! like, blink-and-you-missed-it fast. it's running from an interrupt handler, so do not be out here doing side quests in there 😭

it gets passed the event flags that triggered the call β€” and those flags are a bitmask containing any of these values:

  • 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 πŸŒ€
⚠️ important caveat, don't skip this one: even if your mouse has more than three buttons, only the first three can be trapped using a callback. the rest of your extra buttons are just… not invited to this party πŸ™ˆ

πŸŽ€ SEE ALSO πŸŽ€

  • install_mouse(3) β€” go read that one next, bestie, it's the prequel πŸ’œ

and that's the whole page, you ate it, periodt πŸ‘‘

this lil love letter was brought to you by Allegro, version 4.4.3 β€” mwah, catch you in the next manpage πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from