-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInputBinding.h
74 lines (62 loc) · 1.82 KB
/
InputBinding.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
/*----------------------------------------------
Ruben Young ([email protected])
Date : 2019/10
Description : Various class/struct definitions
to be used by the Inputhandling InputSystem class
----------------------------------------------*/
#ifndef INPUTBINDING_H
#define INPUTBINDING_H
// std inclusions
#include <string>
#include <array>
#include <vector>
#include <windows.h>
namespace Input {
// Enumeration of different GameCommands
enum class GameCommands
{
Quit,
MoveForward,
MoveBackward,
MoveLeft,
MoveRight,
CameraRotation
};
// Enum to emphasize the different states of a key
enum class KeyState
{
StillReleased,
JustPressed,
StillPressed,
JustReleased
};
// Wrapping struct keycode and above enum
struct Binding
{
private:
unsigned int keyCode; // Windows Keycode
KeyState keyState; // Associated keystate
public:
Binding();
Binding(const unsigned int pkeyCode, const KeyState pkeyState);
~Binding() {};
friend class InputSystem;
};
// Maps a game command to a Binding
struct Chord
{
private:
std::wstring name; // Human readable command name
std::vector<Binding> chord; // Sequence of keys mapped to "m_Name" command
public:
Chord();
Chord(const std::wstring& pName, const unsigned int pKeyCode, const KeyState pKeyState);
Chord(const std::wstring& pName, const Binding& pChord);
Chord(const std::wstring& pName, const std::vector<Binding>& plChord);
~Chord() {};
// Accessors for member variables
std::vector<Binding>& GetChord() { return chord; }
std::wstring& GetName() { return name; }
};
}
#endif