poll_mouse(3)
π poll_mouse(3) π
okay bestie, we're in the Allegro manual today, and this one is from the Allegro game programming library β yes, that Allegro, the one your gamedev mutuals keep posting about. let's get into it π
β¨ SYNOPSIS β¨
#include <allegro.h>
int poll_mouse();
that's it. that's the whole vibe. one line of C and it's lowkey carrying your entire cursor situation π¦
πΈ DESCRIPTION πΈ
so here's the tea. wherever possible, Allegro reads your mouse input asynchronously β meaning it's peeking at it from inside an interrupt handler, doing the work behind your back, main character energy, no help required from you π
but on some platforms that may not be possible. and when that happens? it's giving you have to do it, bestie. you must call this routine at regular intervals to update the mouse state variables. that's the whole job. that's the assignment.
and now the part that's actually kind of iconic β the way that Allegro lets you test your mouse polling code even if you're programming on a platform that doesn't require it?? because after the first time you call this function, Allegro will switch into polling mode. periodt. and from that point onwards, you have to call this routine in order to get any mouse input at all, regardless of whether the current driver actually needs to be polled or not.
π no cap: once you've called it one single time, there's no going back to the free async life. it's polling mode forever now. that's the deal. that's the trade. iykyk.
β RETURN VALUE β
- zero on success β¨ slay
- a negative number on failure β specifically, like, no mouse driver installed π so if you get a negative back, check your driver situation fr fr
π«Ά SEE ALSO π«Ά
mouse_needs_poll(3)install_mouse(3)mouse_x(3)exlights(3)exmouse(3)exshade(3)exspline(3)extrans(3)
go read mouse_needs_poll(3) next if you're nosy about whether your platform is one of the poll-requiring ones π it's literally the sibling of this function.
and that's the page bestie π this whole thing lives in Allegro version 4.4.3, so if you're out here on some other version, maybe double-check before you @ me. mwah, go poll responsibly πππ¦
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms