1install_joystick(3)             Allegro manual             install_joystick(3)
2
3
4

NAME

6       install_joystick  -  Initialises the joystick. Allegro game programming
7       library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       int install_joystick(int type);
14

DESCRIPTION

16       Installs Allegro's joystick handler, and calibrates the centre position
17       values.  The  type  parameter should usually be JOY_TYPE_AUTODETECT, or
18       see the platform specific documentation for a  list  of  the  available
19       drivers.   You  must  call this routine before using any other joystick
20       functions, and you should make sure that all joysticks are in the  mid‐
21       dle position at the time. Example:
22
23          textout_centre_ex(screen, font,
24                            "Center the joystick and press a key",
25                            SCREEN_W/2, SCREEN_H/2, red_color, -1);
26          readkey();
27          if (install_joystick(JOY_TYPE_AUTODETECT) != 0)
28             abort_on_error("Error initialising joystick!");
29

RETURN VALUE

31       Returns  zero  on  success.  As soon as you have installed the joystick
32       module, you will be able to read the button state and  digital  (on/off
33       toggle)  direction  information, which may be enough for some games. If
34       you want to get full analogue input, though, you need to use the  cali‐
35       brate_joystick()  functions  to  measure the exact range of the inputs:
36       see below.
37
38

SEE ALSO

40       remove_joystick(3),  num_joysticks(3),   load_joystick_data(3),   cali‐
41       brate_joystick(3),     calibrate_joystick_name(3),    poll_joystick(3),
42       exjoy(3)
43
44
45
46Allegro                          version 4.4.2             install_joystick(3)
Impressum