al_mouse_button_down(3alleg5)
β¨ 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_LEFTALLEGRO_MOUSE_BUTTON_RIGHTALLEGRO_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
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms