-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModuleInput.h
More file actions
78 lines (64 loc) · 1.36 KB
/
ModuleInput.h
File metadata and controls
78 lines (64 loc) · 1.36 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
74
75
76
77
78
#ifndef MODULEINPUT_H
#define MODULEINPUT_H
#include "Module.h"
#include "Point.h"
#include "SDL/include/SDL_scancode.h"
#define MODULE_INPUT "ModuleInput"
#define INPUT_SECTION "Config.Modules.Input"
class JSONParser;
enum EventWindow
{
WE_QUIT = 0,
WE_HIDE = 1,
WE_SHOW = 2,
WE_COUNT
};
enum KeyState
{
KEY_IDLE = 0,
KEY_DOWN,
KEY_REPEAT,
KEY_UP
};
enum PlayerOutput
{
GO_UP = 0,
GO_DOWN,
GO_LEFT,
GO_RIGHT,
START,
PUNCH,
JUMP,
KICK
};
class ModuleInput : public Module
{
public:
ModuleInput(JSONParser* parser);
~ModuleInput();
bool Init();
bool Start();
update_status PreUpdate();
bool CleanUp();
KeyState GetKey(int id) const { return keyboard[id]; }
KeyState GetMouseButtonDown(int id) const { return mouse_buttons[id - 1]; }
bool GetWindowEvent(EventWindow code) const { return bwindowEvents[code]; }
const iPoint& GetMouseMotion() const { return mouse_motion; }
const iPoint& GetMousePosition() const { return mouse; }
bool GetPlayerOutput(int num_player, PlayerOutput input) const;
bool GetPlayerOutput_KeyDown(int num_player, PlayerOutput input) const;
private:
bool bwindowEvents[WE_COUNT];
KeyState* keyboard;
KeyState* mouse_buttons;
iPoint mouse_motion;
iPoint mouse;
SDL_Scancode* keys_player;
int iMAX_KEYS;
int iNUM_BUTTONS;
int iSCREENSIZE;
int iNUMBERPLAYERS;
int iKEYS_PLAYER;
int icount = 0;
};
#endif // !MODULEINPUT_H