File: al_set_mouse_wheel_precision.3

package info (click to toggle)
allegro5 2%3A5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,032 kB
  • sloc: ansic: 120,340; cpp: 15,707; objc: 4,805; python: 2,915; java: 2,195; sh: 887; xml: 86; makefile: 49; perl: 37; pascal: 24
file content (49 lines) | stat: -rw-r--r-- 1,415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
.TH "al_set_mouse_wheel_precision" "3" "" "Allegro reference manual" ""
.SH NAME
.PP
al_set_mouse_wheel_precision \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

void\ al_set_mouse_wheel_precision(int\ precision)
\f[]
.fi
.SH DESCRIPTION
.PP
Sets the precision of the mouse wheel (the z and w coordinates).
This precision manifests itself as a multiplier on the \f[C]dz\f[] and
\f[C]dw\f[] fields in mouse events.
It also affects the \f[C]z\f[] and \f[C]w\f[] fields of events and
ALLEGRO_MOUSE_STATE(3), but not in a simple way if you alter the
precision often, so it is suggested to reset those axes to 0 when you
change precision.
Setting this to a high value allows you to detect small changes in those
two axes for some high precision mice.
A flexible way of using this precision is to set it to a high value (120
is likely sufficient for most, if not all, mice) and use a floating
point \f[C]dz\f[] and \f[C]dw\f[] like so:
.IP
.nf
\f[C]
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...\ */
}
\f[]
.fi
.PP
Precision is set to 1 by default.
It is impossible to set it to a lower precision than that.
.SH SINCE
.PP
5.1.10
.SH SEE ALSO
.PP
al_get_mouse_wheel_precision(3)