al_mouse_button_down(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ al_mouse_button_down ✨

okay bestie, welcome to the <code>3alleg5</code> manual πŸ’– β€” aka the Allegro 5 API corner of the internet where we learn how to ask a mouse if one of its buttons is being held down. yes, really. it's giving detective energy and we love that for us πŸ”


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

bool al_mouse_button_down(const ALLEGRO_MOUSE_STATE *state, int button)

like. that's it. that's the whole vibe. two params and a bool 🫢


πŸ’… DESCRIPTION πŸ’…

So the way this works: it returns true if the mouse button you specified was held down in the state you specified. That's the entire job. No cap. πŸ’―

⚠️ plot twist that WILL trip you up: unlike, like, basically everything else in programming, the first mouse button is numbered 1. Not zero. ONE. not 0!! do not come for me, I don't make the rules, I just report them 😭

And because the Allegro devs are icons who care about us πŸ‘‘, they threw in some convenience constants so you don't have to remember numbers like a peasant:

  • ALLEGRO_MOUSE_BUTTON_LEFT
  • ALLEGRO_MOUSE_BUTTON_RIGHT
  • ALLEGRO_MOUSE_BUTTON_MIDDLE

✨ use these. your future self will thank you. ✨

BUT β€” and this is the tea β˜• β€” depending on the hardware, there may be more or fewer mouse buttons. Every mouse is a unique little main character with its own button count, fr fr. So if you wanna be sure, go check al_get_mouse_num_buttons(3alleg5) before you start assuming things. vibe check your hardware first, bestie πŸ–±οΈπŸ¦‹


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, gorgeous. this was pulled straight from the Allegro reference manual β€” the al_mouse_button_down(3alleg5) page, in all its glory. go forth and click responsibly πŸ’œπŸŽ€πŸ§š

πŸ“¦ where this page comes from