-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleInput.h
More file actions
79 lines (62 loc) · 1.24 KB
/
Copy pathModuleInput.h
File metadata and controls
79 lines (62 loc) · 1.24 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
79
#ifndef __ModuleInput_H__
#define __ModuleInput_H__
#include "Module.h"
#include "Globals.h"
#include "Point.h"
#include "SDL/SDL_scancode.h"
typedef unsigned __int8 Uint8;
#define NUM_MOUSE_BUTTONS 5
enum EventWindow
{
WE_QUIT = 0,
WE_HIDE = 1,
WE_SHOW = 2,
WE_COUNT
};
enum KeyState
{
KEY_IDLE = 0,
KEY_DOWN,
KEY_REPEAT,
KEY_UP
};
class ModuleInput : public Module
{
public:
ModuleInput();
~ModuleInput();
bool Init();
update_status PreUpdate();
update_status Update();
bool CleanUp();
KeyState GetKey(int id) const
{
return keyboard[id];
}
KeyState GetMouseButtonDown(int id) const
{
return mouse_buttons[id - 1];
}
void SetMouseButton(int id)
{
mouse_buttons[id - 1] = KEY_IDLE;
return;
}
bool GetWindowEvent(EventWindow code) const;
// Get mouse / axis position
const fPoint& GetMouseMotion() const;
const fPoint& GetMousePosition() const;
const int GetMouseWheel() const;
private:
//const Uint8 *keyboard = NULL;
bool windowEvents[WE_COUNT];
KeyState* keyboard;
KeyState mouse_buttons[NUM_MOUSE_BUTTONS];
fPoint mouse_motion = {0.0f,0.0f};
fPoint mouse = { 0.0f, 0.0f };
int mouse_wheel;
//Dropping files
char* dropped_filedir;
void DropModelFile(char* dropped_filedir);
};
#endif __ModuleInput_H__