aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/src/keyCodes.cpp
blob: 5f3aa9658a6ec084920164bd10ab50948276f2f5 (plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "keyCodes.h"

const std::unordered_map<SDL_Keycode, Keycode> sdlToCustom
	= {{SDLK_SPACE, Space},
	   {SDLK_QUOTE, Apostrophe},
	   {SDLK_COMMA, Comma},
	   {SDLK_MINUS, Minus},
	   {SDLK_PERIOD, Period},
	   {SDLK_SLASH, Slash},

	   {SDLK_0, D0},
	   {SDLK_1, D1},
	   {SDLK_2, D2},
	   {SDLK_3, D3},
	   {SDLK_4, D4},
	   {SDLK_5, D5},
	   {SDLK_6, D6},
	   {SDLK_7, D7},
	   {SDLK_8, D8},
	   {SDLK_9, D9},

	   {SDLK_SEMICOLON, Semicolon},
	   {SDLK_EQUALS, Equal},

	   {SDLK_a, A},
	   {SDLK_b, B},
	   {SDLK_c, C},
	   {SDLK_d, D},
	   {SDLK_e, E},
	   {SDLK_f, F},
	   {SDLK_g, G},
	   {SDLK_h, H},
	   {SDLK_i, I},
	   {SDLK_j, J},
	   {SDLK_k, K},
	   {SDLK_l, L},
	   {SDLK_m, M},
	   {SDLK_n, N},
	   {SDLK_o, O},
	   {SDLK_p, P},
	   {SDLK_q, Q},
	   {SDLK_r, R},
	   {SDLK_s, S},
	   {SDLK_t, T},
	   {SDLK_u, U},
	   {SDLK_v, V},
	   {SDLK_w, W},
	   {SDLK_x, X},
	   {SDLK_y, Y},
	   {SDLK_z, Z},

	   {SDLK_LEFTBRACKET, LeftBracket},
	   {SDLK_BACKSLASH, Backslash},
	   {SDLK_RIGHTBRACKET, RightBracket},
	   {SDLK_BACKQUOTE, GraveAccent},

	   {SDLK_ESCAPE, Escape},
	   {SDLK_RETURN, Enter},
	   {SDLK_TAB, Tab},
	   {SDLK_BACKSPACE, Backspace},
	   {SDLK_INSERT, Insert},
	   {SDLK_DELETE, Delete},
	   {SDLK_RIGHT, Right},
	   {SDLK_LEFT, Left},
	   {SDLK_DOWN, Down},
	   {SDLK_UP, Up},
	   {SDLK_PAGEUP, PageUp},
	   {SDLK_PAGEDOWN, PageDown},
	   {SDLK_HOME, Home},
	   {SDLK_END, End},

	   {SDLK_CAPSLOCK, CapsLock},
	   {SDLK_SCROLLLOCK, ScrollLock},
	   {SDLK_NUMLOCKCLEAR, NumLock},
	   {SDLK_PRINTSCREEN, PrintScreen},
	   {SDLK_PAUSE, Pause},

	   {SDLK_F1, F1},
	   {SDLK_F2, F2},
	   {SDLK_F3, F3},
	   {SDLK_F4, F4},
	   {SDLK_F5, F5},
	   {SDLK_F6, F6},
	   {SDLK_F7, F7},
	   {SDLK_F8, F8},
	   {SDLK_F9, F9},
	   {SDLK_F10, F10},
	   {SDLK_F11, F11},
	   {SDLK_F12, F12},
	   {SDLK_F13, F13},
	   {SDLK_F14, F14},
	   {SDLK_F15, F15},
	   {SDLK_F16, F16},
	   {SDLK_F17, F17},
	   {SDLK_F18, F18},
	   {SDLK_F19, F19},
	   {SDLK_F20, F20},
	   {SDLK_F21, F21},
	   {SDLK_F22, F22},
	   {SDLK_F23, F23},
	   {SDLK_F24, F24},

	   {SDLK_KP_0, KP0},
	   {SDLK_KP_1, KP1},
	   {SDLK_KP_2, KP2},
	   {SDLK_KP_3, KP3},
	   {SDLK_KP_4, KP4},
	   {SDLK_KP_5, KP5},
	   {SDLK_KP_6, KP6},
	   {SDLK_KP_7, KP7},
	   {SDLK_KP_8, KP8},
	   {SDLK_KP_9, KP9},

	   {SDLK_KP_DECIMAL, KPDecimal},
	   {SDLK_KP_DIVIDE, KPDivide},
	   {SDLK_KP_MULTIPLY, KPMultiply},
	   {SDLK_KP_MINUS, KPSubtract},
	   {SDLK_KP_PLUS, KPAdd},
	   {SDLK_KP_ENTER, KPEnter},
	   {SDLK_KP_EQUALS, KPEqual},

	   {SDLK_LSHIFT, LeftShift},
	   {SDLK_LCTRL, LeftControl},
	   {SDLK_LALT, LeftAlt},
	   {SDLK_LGUI, LeftSuper},

	   {SDLK_RSHIFT, RightShift},
	   {SDLK_RCTRL, RightControl},
	   {SDLK_RALT, RightAlt},
	   {SDLK_RGUI, RightSuper},

	   {SDLK_MENU, Menu}};
Keycode getCustomKey(SDL_Keycode sdlKey) {
	auto it = sdlToCustom.find(sdlKey);
	if (it != sdlToCustom.end()) {
		return it->second;
	}
	return 0;
}