generated from ange-yaghi/delta-template
-
Notifications
You must be signed in to change notification settings - Fork 868
Expand file tree
/
Copy pathjoystick.h
More file actions
73 lines (54 loc) · 1.27 KB
/
joystick.h
File metadata and controls
73 lines (54 loc) · 1.27 KB
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
63
64
65
66
67
68
69
70
71
72
73
#ifndef ATG_ENGINE_SIM_JOYSTICK_H
#define ATG_ENGINE_SIM_JOYSTICK_H
#include <Xinput.h>
class Joystick
{
public:
XINPUT_STATE GetState();
int GetIndex();
bool Alive();
void Update();
void RefreshState();
void Rumble(float a_fLM, float a_fRM);
float LT();
float RT();
bool buttonPressed(int j_iButton);
bool buttonDown(int j_iButton);
Joystick();
Joystick(int j_iIndex);
private:
XINPUT_STATE j_State;
int j_JoystickIndex;
static const int button_count = 14;
bool bStates_prev[button_count];
bool bStates[button_count];
bool b_ButtonsDown[button_count];
};
static const WORD XINPUT_Buttons[] = {
XINPUT_GAMEPAD_A,
XINPUT_GAMEPAD_B,
XINPUT_GAMEPAD_X,
XINPUT_GAMEPAD_Y,
XINPUT_GAMEPAD_DPAD_UP,
XINPUT_GAMEPAD_DPAD_DOWN,
XINPUT_GAMEPAD_DPAD_LEFT,
XINPUT_GAMEPAD_DPAD_RIGHT,
XINPUT_GAMEPAD_LEFT_SHOULDER,
XINPUT_GAMEPAD_RIGHT_SHOULDER,
XINPUT_GAMEPAD_LEFT_THUMB,
XINPUT_GAMEPAD_RIGHT_THUMB,
XINPUT_GAMEPAD_START,
XINPUT_GAMEPAD_BACK
};
struct button_id
{
button_id();
int A, B, X, Y;
int d_up, d_down, d_left , d_right;
int l_s, r_s;
int l_th, r_th;
int start;
int back;
};
#endif /* ATG_ENGINE_SIM_JOYSTICK_H */
extern button_id j_Buttons;