4#include "window/GLFW.hpp"
71 enum class KeyboardAction { PRESSED = GLFW_PRESS, RELEASED = GLFW_RELEASE };
77 enum class KeyboardKey {
78 KEY_UNKNOWN = GLFW_KEY_UNKNOWN,
79 KEY_SPACE = GLFW_KEY_SPACE,
80 KEY_APOSTROPHE = GLFW_KEY_APOSTROPHE,
81 KEY_COMMA = GLFW_KEY_COMMA,
82 KEY_MINUS = GLFW_KEY_MINUS,
83 KEY_PERIOD = GLFW_KEY_PERIOD,
84 KEY_SLASH = GLFW_KEY_SLASH,
95 KEY_SEMICOLON = GLFW_KEY_SEMICOLON,
96 KEY_EQUAL = GLFW_KEY_EQUAL,
123 KEY_LEFT_BRACKET = GLFW_KEY_LEFT_BRACKET,
124 KEY_BACKSLASH = GLFW_KEY_BACKSLASH,
125 KEY_RIGHT_BRACKET = GLFW_KEY_RIGHT_BRACKET,
126 KEY_GRAVE_ACCENT = GLFW_KEY_GRAVE_ACCENT,
127 KEY_WORLD_1 = GLFW_KEY_WORLD_1,
128 KEY_WORLD_2 = GLFW_KEY_WORLD_2,
129 KEY_ESCAPE = GLFW_KEY_ESCAPE,
130 KEY_ENTER = GLFW_KEY_ENTER,
131 KEY_TAB = GLFW_KEY_TAB,
132 KEY_BACKSPACE = GLFW_KEY_BACKSPACE,
133 KEY_INSERT = GLFW_KEY_INSERT,
134 KEY_DELETE = GLFW_KEY_DELETE,
135 KEY_RIGHT = GLFW_KEY_RIGHT,
136 KEY_LEFT = GLFW_KEY_LEFT,
137 KEY_DOWN = GLFW_KEY_DOWN,
138 KEY_UP = GLFW_KEY_UP,
139 KEY_PAGE_UP = GLFW_KEY_PAGE_UP,
140 KEY_PAGE_DOWN = GLFW_KEY_PAGE_DOWN,
141 KEY_HOME = GLFW_KEY_HOME,
142 KEY_END = GLFW_KEY_END,
143 KEY_CAPS_LOCK = GLFW_KEY_CAPS_LOCK,
144 KEY_SCROLL_LOCK = GLFW_KEY_SCROLL_LOCK,
145 KEY_NUM_LOCK = GLFW_KEY_NUM_LOCK,
146 KEY_PRINT_SCREEN = GLFW_KEY_PRINT_SCREEN,
147 KEY_PAUSE = GLFW_KEY_PAUSE,
148 KEY_F1 = GLFW_KEY_F1,
149 KEY_F2 = GLFW_KEY_F2,
150 KEY_F3 = GLFW_KEY_F3,
151 KEY_F4 = GLFW_KEY_F4,
152 KEY_F5 = GLFW_KEY_F5,
153 KEY_F6 = GLFW_KEY_F6,
154 KEY_F7 = GLFW_KEY_F7,
155 KEY_F8 = GLFW_KEY_F8,
156 KEY_F9 = GLFW_KEY_F9,
157 KEY_F10 = GLFW_KEY_F10,
158 KEY_F11 = GLFW_KEY_F11,
159 KEY_F12 = GLFW_KEY_F12,
160 KEY_F13 = GLFW_KEY_F13,
161 KEY_F14 = GLFW_KEY_F14,
162 KEY_F15 = GLFW_KEY_F15,
163 KEY_F16 = GLFW_KEY_F16,
164 KEY_F17 = GLFW_KEY_F17,
165 KEY_F18 = GLFW_KEY_F18,
166 KEY_F19 = GLFW_KEY_F19,
167 KEY_F20 = GLFW_KEY_F20,
168 KEY_F21 = GLFW_KEY_F21,
169 KEY_F22 = GLFW_KEY_F22,
170 KEY_F23 = GLFW_KEY_F23,
171 KEY_F24 = GLFW_KEY_F24,
172 KEY_F25 = GLFW_KEY_F25,
173 KEY_KP_0 = GLFW_KEY_KP_0,
174 KEY_KP_1 = GLFW_KEY_KP_1,
175 KEY_KP_2 = GLFW_KEY_KP_2,
176 KEY_KP_3 = GLFW_KEY_KP_3,
177 KEY_KP_4 = GLFW_KEY_KP_4,
178 KEY_KP_5 = GLFW_KEY_KP_5,
179 KEY_KP_6 = GLFW_KEY_KP_6,
180 KEY_KP_7 = GLFW_KEY_KP_7,
181 KEY_KP_8 = GLFW_KEY_KP_8,
182 KEY_KP_9 = GLFW_KEY_KP_9,
183 KEY_KP_DECIMAL = GLFW_KEY_KP_DECIMAL,
184 KEY_KP_DIVIDE = GLFW_KEY_KP_DIVIDE,
185 KEY_KP_MULTIPLY = GLFW_KEY_KP_MULTIPLY,
186 KEY_KP_SUBTRACT = GLFW_KEY_KP_SUBTRACT,
187 KEY_KP_ADD = GLFW_KEY_KP_ADD,
188 KEY_KP_ENTER = GLFW_KEY_KP_ENTER,
189 KEY_KP_EQUAL = GLFW_KEY_KP_EQUAL,
190 KEY_LEFT_SHIFT = GLFW_KEY_LEFT_SHIFT,
191 KEY_LEFT_CONTROL = GLFW_KEY_LEFT_CONTROL,
192 KEY_LEFT_ALT = GLFW_KEY_LEFT_ALT,
193 KEY_LEFT_SUPER = GLFW_KEY_LEFT_SUPER,
194 KEY_RIGHT_SHIFT = GLFW_KEY_RIGHT_SHIFT,
195 KEY_RIGHT_CONTROL = GLFW_KEY_RIGHT_CONTROL,
196 KEY_RIGHT_ALT = GLFW_KEY_RIGHT_ALT,
197 KEY_RIGHT_SUPER = GLFW_KEY_RIGHT_SUPER,
198 KEY_MENU = GLFW_KEY_MENU,
209 inline std::string getKeyName(KeyboardKey key) {
210 const auto pName = glfwGetKeyName(
static_cast<int>(key), 0);
211 if (pName ==
nullptr) {
213 case KeyboardKey::KEY_TAB:
215 case KeyboardKey::KEY_CAPS_LOCK:
217 case KeyboardKey::KEY_LEFT_SHIFT:
219 case KeyboardKey::KEY_RIGHT_SHIFT:
220 return "Right Shift";
221 case KeyboardKey::KEY_LEFT_CONTROL:
223 case KeyboardKey::KEY_RIGHT_CONTROL:
225 case KeyboardKey::KEY_LEFT_SUPER:
227 case KeyboardKey::KEY_RIGHT_SUPER:
228 return "Right Super";
229 case KeyboardKey::KEY_LEFT_ALT:
231 case KeyboardKey::KEY_RIGHT_ALT:
233 case KeyboardKey::KEY_BACKSPACE:
235 case KeyboardKey::KEY_ENTER:
237 case KeyboardKey::KEY_UP:
239 case KeyboardKey::KEY_DOWN:
241 case KeyboardKey::KEY_LEFT:
243 case KeyboardKey::KEY_RIGHT:
245 case KeyboardKey::KEY_SPACE:
247 case KeyboardKey::KEY_ESCAPE:
249 case KeyboardKey::KEY_F1:
251 case KeyboardKey::KEY_F2:
253 case KeyboardKey::KEY_F3:
255 case KeyboardKey::KEY_F4:
257 case KeyboardKey::KEY_F5:
259 case KeyboardKey::KEY_F6:
261 case KeyboardKey::KEY_F7:
263 case KeyboardKey::KEY_F8:
265 case KeyboardKey::KEY_F9:
267 case KeyboardKey::KEY_F10:
269 case KeyboardKey::KEY_F11:
271 case KeyboardKey::KEY_F12:
273 case KeyboardKey::KEY_F13:
275 case KeyboardKey::KEY_F14:
277 case KeyboardKey::KEY_F15:
279 case KeyboardKey::KEY_F16:
281 case KeyboardKey::KEY_F17:
283 case KeyboardKey::KEY_F18:
285 case KeyboardKey::KEY_F19:
287 case KeyboardKey::KEY_F20:
289 case KeyboardKey::KEY_F21:
291 case KeyboardKey::KEY_F22:
293 case KeyboardKey::KEY_F23:
295 case KeyboardKey::KEY_F24:
297 case KeyboardKey::KEY_F25:
299 case KeyboardKey::KEY_PRINT_SCREEN:
300 return "Print Screen";
301 case KeyboardKey::KEY_INSERT:
303 case KeyboardKey::KEY_DELETE:
Definition: KeyboardKey.hpp:10
bool isNumLockPressed() const
Definition: KeyboardKey.hpp:61
bool isCapsLockPressed() const
Definition: KeyboardKey.hpp:54
bool isSuperPressed() const
Definition: KeyboardKey.hpp:47
bool isShiftPressed() const
Definition: KeyboardKey.hpp:26
int iModifiers
Definition: KeyboardKey.hpp:65
bool isAltPressed() const
Definition: KeyboardKey.hpp:40
bool isControlPressed() const
Definition: KeyboardKey.hpp:33
KeyboardModifiers(int iModifiers)
Definition: KeyboardKey.hpp:19