Handle number of M68K cycles used when tracing in debugger mode
[clinton/Virtual-Jaguar-Rx.git] / src / gui / gamepad.h
CommitLineData
cf76e892
JPM
1//
2// gamepad.h: Header file
3//
4// by James Hammons
5// (C) 2013 Underground Software
6//
7
8#ifndef __GAMEPAD_H__
9#define __GAMEPAD_H__
10
11#define JOY_KEY 0x000000
12#define JOY_BUTTON 0x010000
13#define JOY_HAT 0x020000
14#define JOY_AXIS 0x040000
15
16#define JOY_TYPE_MASK 0xFF0000
17#define JOY_BUTTON_MASK 0x00FFFF
18#define JOY_HATNUM_MASK 0x0000F8
19#define JOY_HATBUT_MASK 0x000007
20#define JOY_AXISNUM_MASK 0x00FFFE
21#define JOY_AXISDIR_MASK 0x000001
22
23#include <stdint.h>
24#include "SDL.h"
25
26// buttonID is the combination of the type (BUTTON, HAT) and the button #
27// (0-255 for buttons, 0-31 for hats). Hats also have 0-7 for a button #
28// that corresponds to a direction.
29
30class Gamepad
31{
32// really should make all methods and members be static so that we can
33// call this stuff without instantiating one. :-) [DONE]
34 public:
35 Gamepad();
36 ~Gamepad();
37
38 // Class methods...
39 static void AllocateJoysticks(void);
40 static void DeallocateJoysticks(void);
41 static const char * GetJoystickName(int joystickID);
42 static bool GetState(int joystickID, int buttonID);
43 static int CheckButtonPressed(void);
44 static int GetButtonID(void);
45 static int GetJoystickID(void);
46 static void Update(void);
47 static void DumpJoystickStatesToLog(void);
48
49 // Support up to 8 gamepads
50 static int numJoysticks;
51 static SDL_Joystick * pad[8];
52 static char padName[8][128];
53 static int numButtons[8];
54 static int numAxes[8];
55 static int numHats[8];
56 static bool button[8][256];
57 static uint8_t hat[8][32];
58 static int32_t axis[8][32];
59};
60
61#endif // __GAMEPAD_H__