SimpleGL  1.1.0
A framework for platform independent rendering
input.hpp
Go to the documentation of this file.
1 
8 #ifndef INPUT_HPP
9 #define INPUT_HPP
10 
11 #include "SimpleGL_Export.h"
12 
13 #include <GLFW/glfw3.h>
14 
15 namespace sgl {
16 
22  enum class Key {
23 
25  KEY_UNKNOWN = GLFW_KEY_UNKNOWN,
26 
28  KEY_SPACE = GLFW_KEY_SPACE,
29 
31  KEY_APOSTROPHE = GLFW_KEY_APOSTROPHE,
32 
34  KEY_COMMA = GLFW_KEY_COMMA,
35 
37  KEY_MINUS = GLFW_KEY_MINUS,
38 
40  KEY_PERIOD = GLFW_KEY_PERIOD,
41 
43  KEY_SLASH = GLFW_KEY_SLASH,
44 
46  KEY_0 = GLFW_KEY_0,
47 
49  KEY_1 = GLFW_KEY_1,
50 
52  KEY_2 = GLFW_KEY_2,
53 
55  KEY_3 = GLFW_KEY_3,
56 
58  KEY_4 = GLFW_KEY_4,
59 
61  KEY_5 = GLFW_KEY_5,
62 
64  KEY_6 = GLFW_KEY_6,
65 
67  KEY_7 = GLFW_KEY_7,
68 
70  KEY_8 = GLFW_KEY_8,
71 
73  KEY_9 = GLFW_KEY_9,
74 
76  KEY_SEMICOLON = GLFW_KEY_SEMICOLON,
77 
79  KEY_EQUAL = GLFW_KEY_EQUAL,
80 
82  KEY_A = GLFW_KEY_A,
83 
85  KEY_B = GLFW_KEY_B,
86 
88  KEY_C = GLFW_KEY_C,
89 
91  KEY_D = GLFW_KEY_D,
92 
94  KEY_E = GLFW_KEY_E,
95 
97  KEY_F = GLFW_KEY_F,
98 
100  KEY_G = GLFW_KEY_G,
101 
103  KEY_H = GLFW_KEY_H,
104 
106  KEY_I = GLFW_KEY_I,
107 
109  KEY_J = GLFW_KEY_J,
110 
112  KEY_K = GLFW_KEY_K,
113 
115  KEY_L = GLFW_KEY_L,
116 
118  KEY_M = GLFW_KEY_M,
119 
121  KEY_N = GLFW_KEY_N,
122 
124  KEY_O = GLFW_KEY_O,
125 
127  KEY_P = GLFW_KEY_P,
128 
130  KEY_Q = GLFW_KEY_Q,
131 
133  KEY_R = GLFW_KEY_R,
134 
136  KEY_S = GLFW_KEY_S,
137 
139  KEY_T = GLFW_KEY_T,
140 
142  KEY_U = GLFW_KEY_U,
143 
145  KEY_V = GLFW_KEY_V,
146 
148  KEY_W = GLFW_KEY_W,
149 
151  KEY_X = GLFW_KEY_X,
152 
154  KEY_Y = GLFW_KEY_Y,
155 
157  KEY_Z = GLFW_KEY_Z,
158 
160  KEY_LEFT_BRACKET = GLFW_KEY_LEFT_BRACKET,
161 
163  KEY_BACKSLASH = GLFW_KEY_BACKSLASH,
164 
166  KEY_RIGHT_BRACKET = GLFW_KEY_RIGHT_BRACKET,
167 
169  KEY_GRAVE_ACCENT = GLFW_KEY_GRAVE_ACCENT,
170 
172  KEY_WORLD_1 = GLFW_KEY_WORLD_1,
173 
175  KEY_WORLD_2 = GLFW_KEY_WORLD_2,
176 
178  KEY_ESCAPE = GLFW_KEY_ESCAPE,
179 
181  KEY_ENTER = GLFW_KEY_ENTER,
182 
184  KEY_TAB = GLFW_KEY_TAB,
185 
187  KEY_BACKSPACE = GLFW_KEY_BACKSPACE,
188 
190  KEY_INSERT = GLFW_KEY_INSERT,
191 
193  KEY_DELETE = GLFW_KEY_DELETE,
194 
196  KEY_RIGHT = GLFW_KEY_RIGHT,
197 
199  KEY_LEFT = GLFW_KEY_LEFT,
200 
202  KEY_DOWN = GLFW_KEY_DOWN,
203 
205  KEY_UP = GLFW_KEY_UP,
206 
208  KEY_PAGE_UP = GLFW_KEY_PAGE_UP,
209 
211  KEY_PAGE_DOWN = GLFW_KEY_PAGE_DOWN,
212 
214  KEY_HOME = GLFW_KEY_HOME,
215 
217  KEY_END = GLFW_KEY_END,
218 
220  KEY_CAPS_LOCK = GLFW_KEY_CAPS_LOCK,
221 
223  KEY_SCROLL_LOCK = GLFW_KEY_SCROLL_LOCK,
224 
226  KEY_NUM_LOCK = GLFW_KEY_NUM_LOCK,
227 
229  KEY_PRINT_SCREEN = GLFW_KEY_PRINT_SCREEN,
230 
232  KEY_PAUSE = GLFW_KEY_PAUSE,
233 
235  KEY_F1 = GLFW_KEY_F1,
236 
238  KEY_F2 = GLFW_KEY_F2,
239 
241  KEY_F3 = GLFW_KEY_F3,
242 
244  KEY_F4 = GLFW_KEY_F4,
245 
247  KEY_F5 = GLFW_KEY_F5,
248 
250  KEY_F6 = GLFW_KEY_F6,
251 
253  KEY_F7 = GLFW_KEY_F7,
254 
256  KEY_F8 = GLFW_KEY_F8,
257 
259  KEY_F9 = GLFW_KEY_F9,
260 
262  KEY_F10 = GLFW_KEY_F10,
263 
265  KEY_F11 = GLFW_KEY_F11,
266 
268  KEY_F12 = GLFW_KEY_F12,
269 
271  KEY_F13 = GLFW_KEY_F13,
272 
274  KEY_F14 = GLFW_KEY_F14,
275 
277  KEY_F15 = GLFW_KEY_F15,
278 
280  KEY_F16 = GLFW_KEY_F16,
281 
283  KEY_F17 = GLFW_KEY_F17,
284 
286  KEY_F18 = GLFW_KEY_F18,
287 
289  KEY_F19 = GLFW_KEY_F19,
290 
292  KEY_F20 = GLFW_KEY_F20,
293 
295  KEY_F21 = GLFW_KEY_F21,
296 
298  KEY_F22 = GLFW_KEY_F22,
299 
301  KEY_F23 = GLFW_KEY_F23,
302 
304  KEY_F24 = GLFW_KEY_F24,
305 
307  KEY_F25 = GLFW_KEY_F25,
308 
310  KEY_KP_0 = GLFW_KEY_KP_0,
311 
313  KEY_KP_1 = GLFW_KEY_KP_1,
314 
316  KEY_KP_2 = GLFW_KEY_KP_2,
317 
319  KEY_KP_3 = GLFW_KEY_KP_3,
320 
322  KEY_KP_4 = GLFW_KEY_KP_4,
323 
325  KEY_KP_5 = GLFW_KEY_KP_5,
326 
328  KEY_KP_6 = GLFW_KEY_KP_6,
329 
331  KEY_KP_7 = GLFW_KEY_KP_7,
332 
334  KEY_KP_8 = GLFW_KEY_KP_8,
335 
337  KEY_KP_9 = GLFW_KEY_KP_9,
338 
340  KEY_KP_DECIMAL = GLFW_KEY_KP_DECIMAL,
341 
343  KEY_KP_DIVIDE = GLFW_KEY_KP_DIVIDE,
344 
346  KEY_KP_MULTIPLY = GLFW_KEY_KP_MULTIPLY,
347 
349  KEY_KP_SUBTRACT = GLFW_KEY_KP_SUBTRACT,
350 
352  KEY_KP_ADD = GLFW_KEY_KP_ADD,
353 
355  KEY_KP_ENTER = GLFW_KEY_KP_ENTER,
356 
358  KEY_KP_EQUAL = GLFW_KEY_KP_EQUAL,
359 
361  KEY_LEFT_SHIFT = GLFW_KEY_LEFT_SHIFT,
362 
364  KEY_LEFT_CONTROL = GLFW_KEY_LEFT_CONTROL,
365 
367  KEY_LEFT_ALT = GLFW_KEY_LEFT_ALT,
368 
370  KEY_LEFT_SUPER = GLFW_KEY_LEFT_SUPER,
371 
373  KEY_RIGHT_SHIFT = GLFW_KEY_RIGHT_SHIFT,
374 
376  KEY_RIGHT_CONTROL = GLFW_KEY_RIGHT_CONTROL,
377 
379  KEY_RIGHT_ALT = GLFW_KEY_RIGHT_ALT,
380 
382  KEY_RIGHT_SUPER = GLFW_KEY_RIGHT_SUPER,
383 
385  KEY_MENU = GLFW_KEY_MENU,
386 
388  KEY_LAST = KEY_MENU
389  };
390 
396  enum class MouseButton {
397 
399  MOUSE_BUTTON_1 = GLFW_MOUSE_BUTTON_1,
400 
402  MOUSE_BUTTON_2 = GLFW_MOUSE_BUTTON_2,
403 
405  MOUSE_BUTTON_3 = GLFW_MOUSE_BUTTON_3,
406 
408  MOUSE_BUTTON_4 = GLFW_MOUSE_BUTTON_4,
409 
411  MOUSE_BUTTON_5 = GLFW_MOUSE_BUTTON_5,
412 
414  MOUSE_BUTTON_6 = GLFW_MOUSE_BUTTON_6,
415 
417  MOUSE_BUTTON_7 = GLFW_MOUSE_BUTTON_7,
418 
420  MOUSE_BUTTON_8 = GLFW_MOUSE_BUTTON_8,
421 
424 
427 
430 
432  MOUSE_BUTTON_RIGHT = MOUSE_BUTTON_2
433  };
434 
440  enum class Action {
441 
443  PRESS = GLFW_PRESS,
444 
446  RELEASE = GLFW_RELEASE,
447 
449  REPEAT = GLFW_REPEAT
450  };
451 
457  enum class Modifier {
458 
460  MOD_ALT = GLFW_MOD_ALT,
461 
463  MOD_CONTROL = GLFW_MOD_CONTROL,
464 
466  MOD_SHIFT = GLFW_MOD_SHIFT,
467 
469  MOD_SUPER = GLFW_MOD_SUPER
470  };
471 
478  inline Modifier operator|(Modifier left, Modifier right) {
479  int bitmask = static_cast<int> (left) | static_cast<int> (right);
480  return static_cast<Modifier> (bitmask);
481  };
482 }
483 
484 #endif /* INPUT_HPP */
Equivalent to GLFW_KEY_3.
Equivalent to GLFW_KEY_LEFT_ALT.
Equivalent to GLFW_KEY_KP_ENTER.
Equivalent to GLFW_KEY_WORLD_2.
Equivalent to GLFW_KEY_BACKSPACE.
Equivalent to GLFW_KEY_Q.
Equivalent to GLFW_KEY_ESCAPE.
Equivalent to GLFW_KEY_U.
MouseButton
This enum wraps the GLFW mouse buttons.
Definition: input.hpp:396
Equivalent to GLFW_KEY_RIGHT.
Equivalent to MOUSE_BUTTON_1.
Equivalent to GLFW_KEY_LEFT_SUPER.
Equivalent to GLFW_KEY_J.
Equivalent to GLFW_KEY_F20.
Equivalent to GLFW_KEY_DELETE.
Equivalent to GLFW_KEY_F24.
Equivalent to GLFW_KEY_F14.
Equivalent to GLFW_KEY_SCROLL_LOCK.
Key
This enum wraps the GLFW keys.
Definition: input.hpp:22
Equivalent to GLFW_KEY_F19.
Equivalent to GLFW_KEY_0.
Equivalent to MOUSE_BUTTON_8.
Equivalent to GLFW_KEY_R.
Equivalent to GLFW_KEY_F25.
Equivalent to GLFW_MOUSE_BUTTON_1.
Equivalent to GLFW_KEY_F13.
Equivalent to GLFW_MOUSE_BUTTON_4.
Equivalent to GLFW_KEY_KP_SUBTRACT.
Equivalent to GLFW_KEY_B.
Equivalent to GLFW_MOUSE_BUTTON_3.
Equivalent to GLFW_KEY_F23.
Equivalent to GLFW_MOD_SHIFT.
Equivalent to GLFW_KEY_LEFT_SHIFT.
Equivalent to GLFW_KEY_F15.
Equivalent to GLFW_KEY_S.
Equivalent to GLFW_PRESS.
Equivalent to GLFW_KEY_F9.
Equivalent to GLFW_KEY_2.
Equivalent to GLFW_KEY_6.
Equivalent to GLFW_KEY_TAB.
Equivalent to GLFW_KEY_SLASH.
Equivalent to GLFW_KEY_F6.
Equivalent to GLFW_KEY_NUM_LOCK.
Equivalent to GLFW_KEY_KP_5.
Equivalent to GLFW_KEY_8.
Equivalent to GLFW_KEY_KP_9.
Equivalent to GLFW_KEY_X.
Equivalent to GLFW_MOUSE_BUTTON_5.
Equivalent to GLFW_KEY_I.
Equivalent to GLFW_KEY_F10.
Equivalent to GLFW_KEY_F5.
Equivalent to GLFW_KEY_F4.
Equivalent to GLFW_KEY_E.
Equivalent to GLFW_KEY_PRINT_SCREEN.
Equivalent to GLFW_KEY_9.
Equivalent to GLFW_KEY_KP_DIVIDE.
Equivalent to GLFW_KEY_KP_2.
Modifier
This enum wraps the GLFW modifier bits.
Definition: input.hpp:457
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
Equivalent to GLFW_KEY_KP_0.
Equivalent to GLFW_KEY_F18.
Equivalent to GLFW_KEY_D.
Equivalent to MOUSE_BUTTON_3.
Equivalent to GLFW_MOUSE_BUTTON_8.
Equivalent to GLFW_KEY_KP_EQUAL.
Equivalent to GLFW_MOUSE_BUTTON_6.
Equivalent to GLFW_KEY_7.
Equivalent to GLFW_KEY_PAUSE.
Equivalent to GLFW_KEY_T.
Equivalent to GLFW_KEY_F21.
Equivalent to GLFW_KEY_F17.
Equivalent to GLFW_KEY_APOSTROPHE.
Equivalent to GLFW_KEY_DOWN.
Equivalent to GLFW_KEY_CAPS_LOCK.
Equivalent to GLFW_KEY_COMMA.
Equivalent to GLFW_KEY_PAGE_UP.
Equivalent to GLFW_KEY_W.
Equivalent to GLFW_KEY_LEFT.
Equivalent to GLFW_KEY_EQUAL.
Equivalent to GLFW_KEY_KP_8.
Equivalent to GLFW_KEY_KP_MULTIPLY.
Equivalent to GLFW_MOUSE_BUTTON_2.
Equivalent to GLFW_KEY_F3.
Equivalent to GLFW_KEY_Z.
Equivalent to GLFW_KEY_RIGHT_SHIFT.
Equivalent to GLFW_KEY_M.
Equivalent to GLFW_KEY_F1.
Equivalent to GLFW_KEY_L.
Equivalent to GLFW_KEY_5.
Equivalent to MOUSE_BUTTON_2.
Equivalent to GLFW_KEY_C.
Equivalent to GLFW_MOD_SUPER.
Equivalent to GLFW_KEY_KP_4.
Equivalent to GLFW_REPEAT.
Equivalent to GLFW_KEY_MENU.
Equivalent to GLFW_KEY_RIGHT_ALT.
Equivalent to GLFW_KEY_KP_ADD.
Equivalent to GLFW_KEY_RIGHT_SUPER.
Equivalent to GLFW_KEY_PERIOD.
Equivalent to GLFW_KEY_N.
Equivalent to GLFW_KEY_UP.
Equivalent to GLFW_KEY_F16.
Modifier operator|(Modifier left, Modifier right)
Overloaded OR operator for the modifier bit.
Definition: input.hpp:478
Equivalent to GLFW_KEY_RIGHT_CONTROL.
Equivalent to GLFW_KEY_KP_DECIMAL.
Equivalent to GLFW_KEY_1.
Equivalent to GLFW_KEY_F12.
Equivalent to GLFW_KEY_KP_7.
Equivalent to GLFW_KEY_SPACE.
Equivalent to GLFW_MOUSE_BUTTON_7.
Equivalent to GLFW_KEY_PAGE_DOWN.
Equivalent to GLFW_KEY_F.
Equivalent to GLFW_KEY_F2.
Equivalent to GLFW_KEY_Y.
Equivalent to GLFW_KEY_END.
Action
This enum wraps the GLFW actions.
Definition: input.hpp:440
Equivalent to GLFW_KEY_O.
Equivalent to GLFW_KEY_LEFT_CONTROL.
Equivalent to GLFW_KEY_A.
Equivalent to GLFW_KEY_F22.
Equivalent to GLFW_KEY_KP_1.
Equivalent to GLFW_KEY_WORLD_1.
Equivalent to GLFW_KEY_UNKNOWN.
Equivalent to GLFW_KEY_RIGHT_BRACKET.
Equivalent to GLFW_KEY_KP_3.
Equivalent to GLFW_KEY_P.
Equivalent to GLFW_KEY_V.
Equivalent to GLFW_KEY_F8.
Equivalent to GLFW_MOD_ALT.
Equivalent to GLFW_KEY_G.
Equivalent to GLFW_KEY_LEFT_BRACKET.
Equivalent to GLFW_KEY_K.
Equivalent to GLFW_KEY_GRAVE_ACCENT.
Equivalent to GLFW_KEY_HOME.
Equivalent to KEY_MENU.
Equivalent to GLFW_KEY_BACKSLASH.
Equivalent to GLFW_RELEASE.
Equivalent to GLFW_KEY_H.
Equivalent to GLFW_KEY_ENTER.
Equivalent to GLFW_KEY_4.
Equivalent to GLFW_KEY_SEMICOLON.
Equivalent to GLFW_KEY_INSERT.
Equivalent to GLFW_KEY_F11.
Equivalent to GLFW_KEY_KP_6.
Equivalent to GLFW_KEY_F7.
Equivalent to GLFW_MOD_CONTROL.
Equivalent to GLFW_KEY_MINUS.