al_set_mouse_wheel_precision(3alleg5)

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

✨ 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