al_set_mouse_wheel_precision(3alleg5)
β¨ al_set_mouse_wheel_precision β Allegro 5 API β¨
okay bestie, so this one is from the Allegro 5 API and it's genuinely so fun, like scroll wheel girlies rise up π±οΈπ
πΈ SYNOPSIS πΈ
#include <allegro5/allegro.h>
void al_set_mouse_wheel_precision(int precision)
π DESCRIPTION π
So this function sets the precision of the mouse wheel β and by "mouse wheel" we mean the z and w coordinates, yes both of them, the whole squad. π
This precision shows up as a multiplier on the dz and dw fields in mouse events. It also does stuff to the z and w fields of events and of ALLEGRO_MOUSE_STATE(3alleg5) β but not in a simple way if you go changing the precision all the time π, so the suggestion is to reset those axes to 0 whenever you change precision. Noted, queen, we love a clean slate.
Setting it to a high value lets you detect tiny little changes in those two axes for some high precision mice. β¨ And the flexible way to use it? Set it to a high value β 120 is likely sufficient for most, if not all, mice β and then use a floating point dz and dw, like so:
al_set_mouse_wheel_precision(120);
ALLEGRO_EVENT event;
al_wait_for_event(event_queue, &event);
if (event.type == ALLEGRO_EVENT_MOUSE_AXES) {
double dz = (double)event.mouse.dz / al_get_mouse_wheel_precision();
/* Use dz in some way... */
}
Precision is set to 1 by default. And no, bestie, it is impossible to set it to a lower precision than that. One is the floor. Periodt. π
π¦ SINCE π¦
5.1.10
π SEE ALSO π
mwah π that's the whole thing β this page came straight out of the Allegro reference manual, for al_set_mouse_wheel_precision(3alleg5), and honestly? iconic. go forth and scroll with precision, iykyk πβ¨
π¦ 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