1calibrate_joystick(3) Allegro manual calibrate_joystick(3)
2
3
4
6 calibrate_joystick - Calibrates the specified joystick. Allegro game
7 programming library.
8
10 #include <allegro.h>
11
12
13 int calibrate_joystick(int n);
14
16 Most joysticks need to be calibrated before they can provide full ana‐
17 logue input. This function performs the next operation in the calibra‐
18 tion series for the specified stick, assuming that the joystick has
19 been positioned in the manner described by a previous call to cali‐
20 brate_joystick_name(), returning zero on success. For example, a simple
21 routine to fully calibrate all the joysticks might look like:
22
23 int i;
24
25 for (i=0; i<;num_joysticks; i++) {
26 while (joy[i].flags & JOYFLAG_CALIBRATE) {
27 char *msg = calibrate_joystick_name(i);
28 textprintf_ex(..., "%s, and press a key\n", msg);
29 readkey();
30 if (calibrate_joystick(i) != 0) {
31 textprintf_ex(..., "oops!\n");
32 readkey();
33 exit(1);
34 }
35 }
36 }
37
39 Returns zero on success, non-zero if the calibration could not be per‐
40 formed successfully.
41
42
44 install_joystick(3), calibrate_joystick_name(3), joy(3), num_joy‐
45 sticks(3), exjoy(3)
46
47
48
49Allegro version 4.4.3 calibrate_joystick(3)