-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModuleInput.h
More file actions
65 lines (51 loc) · 1.1 KB
/
ModuleInput.h
File metadata and controls
65 lines (51 loc) · 1.1 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
#ifndef __ModuleInput_H__
#define __ModuleInput_H__
#include "Module.h"
#include "Globals.h"
#include "p2Point.h"
//#include "SDL\include\SDL_scancode.h"
#include "SDL\include\SDL.h"
#include "SDL\include\SDL_gamecontroller.h"
#define MAX_KEYS 300
#define MAX_GAMEPADS 2
enum KEY_STATE
{
KEY_IDLE = 0,
KEY_DOWN,
KEY_REPEAT,
KEY_UP
};
typedef unsigned char Uint8;
class ModuleInput : public Module
{
public:
ModuleInput();
~ModuleInput();
bool Init();
update_status PreUpdate();
bool CleanUp();
public:
KEY_STATE keyboard[MAX_KEYS];
//const Uint8 *keyboard = nullptr;
SDL_Event Event;
//gamepad
//SDL_GameController* gamePads[MAX_GAMEPADS] = { nullptr };
struct gamepadData
{
SDL_GameController * gamePadController = nullptr;
//int joystick_index;
SDL_JoystickID joyId = -1;
bool isConnected = false;
bool up = false;
bool down = false;
bool right = false;
bool left = false;
Sint16 axisX = 0;
Sint16 axisY = 0;
int deadZone = 8000;
bool shotPressed = false;
bool lockUnitPressed = false;
};
gamepadData gamePadControllers[MAX_GAMEPADS];
};
#endif // __ModuleInput_H__