forked from hyperlogic/riftty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoystick.h
62 lines (51 loc) · 927 Bytes
/
joystick.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef __JOYSTICK_H__
#define __JOYSTICK_H__
#include <string.h>
#include "abaci.h"
struct SDL_JoyAxisEvent;
struct SDL_JoyButtonEvent;
// based on a Xbox360 Controller
struct Joystick
{
Joystick() { memset(this, sizeof(Joystick), 0); }
enum Axes
{
LeftStickX = 0,
LeftStickY,
RightStickX,
RightStickY,
LeftTrigger,
RightTrigger,
NumAxes
};
float axes[NumAxes];
enum ButtonFlags
{
DPadDown = 0,
DPadUp,
DPadLeft,
DPadRight,
Start,
Back,
LeftStick,
RightStick,
LeftBumper,
RightBumper,
Xbox,
A,
B,
X,
Y,
NumButtons
};
unsigned int buttonStateFlags;
unsigned int buttonPressFlags;
unsigned int buttonReleaseFlags;
};
void JOYSTICK_Init();
void JOYSTICK_Shutdown();
void JOYSTICK_ClearFlags();
void JOYSTICK_UpdateMotion(const SDL_JoyAxisEvent* event);
void JOYSTICK_UpdateButton(const SDL_JoyButtonEvent* event);
Joystick* JOYSTICK_GetJoystick();
#endif