al_set_mou..._precision(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

✨ al_set_mou..._precision ✨

okay so bestie, welcome to the Allegro reference manual entry for al_set_mou..._precision(3) β€” yes the name is a lil truncated, that's just how the man page shows it, and no I'm not ignoring it, it's literally the title πŸ’…


πŸŽ€ NAME πŸŽ€

al_set_mouse_wheel_precision β€” Allegro 5 API πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

void al_set_mouse_wheel_precision(int precision)

πŸ’– DESCRIPTION πŸ’–

okay so this one sets the precision of the mouse wheel β€” like the z and w coordinates ✨. And how does that precision show up? It manifests itself as a multiplier on the dz and dw fields in mouse events πŸ”₯.

It also affects the z and w fields of events and ALLEGRO_MOUSE_STATE(3) β€” but ngl, not in a simple way if you alter the precision often 😭. So the move is: it's suggested to reset those axes to 0 when you change precision. Considerate, right? 🫢

Setting this to a high value lets you detect small changes in those two axes for some high precision mice πŸ‘‘. And the flexible way to use this precision? Set it to a high value (and like, 120 is likely sufficient for most, if not all, mice) and 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 heads up β€” it is impossible to set it to a lower precision than that πŸ’€. Like, 1 is the floor, periodt.


⭐ SINCE ⭐

5.1.10 πŸŽ€


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie!! πŸ’–βœ¨ this was al_set_mou..._precision(3) from the Allegro reference manual β€” mwah, go forth and scroll with precision πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms