-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModuleInput.h
88 lines (73 loc) · 1.19 KB
/
ModuleInput.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma once
#include "Globals.h"
#include "Application.h"
#include "Module.h"
#include "imgui.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
#define MAX_MOUSE_BUTTONS 5
enum KEY_STATE
{
KEY_IDLE = 0,
KEY_DOWN,
KEY_REPEAT,
KEY_UP
};
class ModuleInput : public Module
{
public:
ModuleInput(Application* app, bool start_enabled = true);
~ModuleInput();
bool Init();
update_status PreUpdate(float dt);
bool CleanUp();
KEY_STATE GetKey(int id) const
{
return keyboard[id];
}
KEY_STATE GetMouseButton(int id) const
{
return mouse_buttons[id];
}
int GetMouseX() const
{
return mouse_x;
}
int GetMouseY() const
{
return mouse_y;
}
int GetMouseZ() const
{
return mouse_z;
}
int GetMouseXMotion() const
{
return mouse_x_motion;
}
int GetMouseYMotion() const
{
return mouse_y_motion;
}
void* isWritting() {
if (ImGui::IsItemActive()) {
writting = true;
}
else {
writting = false;
}
return nullptr;
}
public:
bool quit = false;
bool writting = false;
private:
KEY_STATE* keyboard;
KEY_STATE mouse_buttons[MAX_MOUSE_BUTTONS];
int mouse_x;
int mouse_y;
int mouse_z;
int mouse_x_motion;
int mouse_y_motion;
//int mouse_z_motion;
};