-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleInput.h
More file actions
53 lines (43 loc) · 778 Bytes
/
ModuleInput.h
File metadata and controls
53 lines (43 loc) · 778 Bytes
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
#pragma once
#include "Module.h"
#include "Globals.h"
#define MAX_MOUSE_BUTTONS 5
#define MAX_KEYS 300
enum KEY_STATE
{
KEY_IDLE = 0,
KEY_DOWN,
KEY_REPEAT,
KEY_UP,
KEY_ERROR
};
class ModuleInput : public Module
{
public:
ModuleInput(Application* app, bool start_enabled = true);
~ModuleInput();
bool Init();
update_status PreUpdate();
bool CleanUp();
KEY_STATE GetKey(uint id) const
{
return (id < MAX_KEYS) ? keyboard[id] : KEY_ERROR;
}
KEY_STATE GetMouseButton(uint id) const
{
return (id < MAX_MOUSE_BUTTONS) ? mouse_buttons[id] : KEY_ERROR;
}
int GetMouseX() const
{
return mouse_x;
}
int GetMouseY() const
{
return mouse_y;
}
private:
KEY_STATE* keyboard;
KEY_STATE mouse_buttons[MAX_MOUSE_BUTTONS];
int mouse_x;
int mouse_y;
};