1al_set_mouse_wheel_precision(3) al_set_mouse_wheel_precision(3)
2
3
4
6 al_set_mouse_wheel_precision - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 void al_set_mouse_wheel_precision(int precision)
12
14 Sets the precision of the mouse wheel (the z and w coordinates). This
15 precision manifests itself as a multiplier on the dz and dw fields in
16 mouse events. It also affects the z and w fields of events and ALLE‐
17 GRO_MOUSE_STATE(3), but not in a simple way if you alter the precision
18 often, so it is suggested to reset those axes to 0 when you change pre‐
19 cision. Setting this to a high value allows you to detect small
20 changes in those two axes for some high precision mice. A flexible way
21 of using this precision is to set it to a high value (120 is likely
22 sufficient for most, if not all, mice) and use a floating point dz and
23 dw like so:
24
25 al_set_mouse_wheel_precision(120);
26
27 ALLEGRO_EVENT event;
28 al_wait_for_event(event_queue, &event);
29 if (event.type == ALLEGRO_EVENT_MOUSE_AXES) {
30 double dz = (double)event.mouse.dz / al_get_mouse_wheel_precision();
31 /* Use dz in some way... */
32 }
33
34 Precision is set to 1 by default. It is impossible to set it to a low‐
35 er precision than that.
36
38 5.1.10
39
41 al_get_mouse_wheel_precision(3)
42
43
44
45Allegro reference manual al_set_mouse_wheel_precision(3)