1poll_joystick(3) Allegro manual poll_joystick(3)
2
3
4
6 poll_joystick - Polls the joystick. Allegro game programming library.
7
9 #include <allegro.h>
10
11
12 int poll_joystick();
13
15 The joystick handler is not interrupt driven, so you need to call this
16 function every now and again to update the global position values.
17 Example:
18
19 do {
20 /* Get joystick input */
21 poll_joystick();
22
23 /* Process input for the first joystick */
24 if (joy[0].button[0].b)
25 first_button_pressed();
26
27 if (joy[0].button[1].b)
28 second_button_pressed();
29 ...
30 } while(!done);
31
33 Returns zero on success or a negative number on failure (usually
34 because no joystick driver was installed).
35
36
38 install_joystick(3), joy(3), num_joysticks(3), exjoy(3)
39
40
41
42Allegro version 4.2.2 poll_joystick(3)