2 // gamepad.h: Header file
5 // (C) 2013 Underground Software
11 #define JOY_KEY 0x000000
12 #define JOY_BUTTON 0x010000
13 #define JOY_HAT 0x020000
15 #define JOY_TYPE_MASK 0xFF0000
16 #define JOY_BUTTON_MASK 0x00FFFF
17 #define JOY_HATNUM_MASK 0x0000F8
18 #define JOY_HATBUT_MASK 0x000007
23 // buttonID is the combination of the type (BUTTON, HAT) and the button #
24 // (0-255 for buttons, 0-31 for hats). Hats also have 0-7 for a button #
25 // that corresponds to a direction.
29 // really should make all methods and members be static so that we can
30 // call this stuff without instantiating one. :-)
36 static void AllocateJoysticks(void);
37 static void DeallocateJoysticks(void);
38 static bool GetState(int joystickID, int buttonID);
39 static int CheckButtonPressed(void);
40 static int GetButtonID(void);
41 static int GetJoystickID(void);
42 static void Update(void);
44 // Support up to 8 gamepads
45 static int numJoysticks;
46 static SDL_Joystick * pad[8];
47 static int numButtons[8];
48 static int numHats[8];
49 static bool button[8][256];
50 static uint8_t hat[8][32];
53 #endif // __GAMEPAD_H__