-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInput.h
73 lines (56 loc) · 1.43 KB
/
Input.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
#pragma once
#include "includes.h"
class InputSystem
{
friend class Window;
friend class MouseInput;
friend class KeyInput;
private:
static BOOL m_pressedKeysList[255];
static BOOL m_releasedKeysList[255];
static BOOL m_keyStateList[255];
private:
class KeyInput
{
friend class Window;
public:
//KeyPressed Stuff
BOOL GetKeyDown(UINT32 key);
BOOL GetKeyUp(UINT32 key);
BOOL GetKeyState(UINT32 key);
BOOL anyKeyPressed();
VOID allowRepeating(BOOL repeat);
//Char Stuff
UINT32 GetText(std::string* textout);
BOOL GetFinishedText(std::string* textout);
VOID busyWritingText(BOOL busy);
private:
VOID clearList(BOOL* list);
private:
BOOL m_allowRepeating = FALSE;
std::string m_charBuffer = {};
BOOL isWritingText = FALSE;
};
class MouseInput
{
friend class Window;
public:
DirectX::XMUINT2 GetMousePos();
BOOL GetMouseButtonDown(UINT8 button, DirectX::XMUINT2* position);
BOOL GetMouseButtonUp(UINT8 button, DirectX::XMUINT2* position);
INT8 GetMouseWheel();
DirectX::XMINT2 GetRawInputPos();
public:
void HandleRawInput(INT32 x, INT32 y);
private:
DirectX::XMUINT2 m_pressedMouseKeysList[32] = {};
DirectX::XMUINT2 m_releasedMouseKeysList[32] = {};
DirectX::XMUINT2 m_position = {};
DirectX::XMINT2 m_rawInputPosition = {};
INT8 m_mouseWheelOffset;
VOID m_MouseButtonChanged(UINT8 button, BOOL pressed, LPARAM lParam);
};
public:
KeyInput Key;
MouseInput Mouse;
};