Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
event_type.h
1#ifndef OE_CORE_EVENT_TYPE_H
2#define OE_CORE_EVENT_TYPE_H
3
4#include <vector>
5
6namespace oe::core
7{
8 enum class EventType
9 {
12
15
18
21
24
27
30
33
36
38 CUSTOM,
39
41 ALL
42 };
43
49 {
50 static constexpr const int KEY_UNKNOWN = -1;
51
52 static constexpr const int KEY_NONE = 0;
54
55 /* Printable keys */
56 static constexpr const int KEY_SPACE = 32;
57 static constexpr const int KEY_APOSTROPHE = 39;
58 static constexpr const int KEY_COMMA = 44;
59 static constexpr const int KEY_MINUS = 45;
60 static constexpr const int KEY_PERIOD = 46;
61
62 static constexpr const int KEY_SLASH = 47;
63 static constexpr const int KEY_0 = 48;
64 static constexpr const int KEY_1 = 49;
65 static constexpr const int KEY_2 = 50;
66 static constexpr const int KEY_3 = 51;
67 static constexpr const int KEY_4 = 52;
68 static constexpr const int KEY_5 = 53;
69 static constexpr const int KEY_6 = 54;
70 static constexpr const int KEY_7 = 55;
71 static constexpr const int KEY_8 = 56;
72 static constexpr const int KEY_9 = 57;
73 static constexpr const int KEY_SEMICOLON = 59;
74 static constexpr const int KEY_EQUAL = 61;
75 static constexpr const int KEY_A = 65;
76 static constexpr const int KEY_B = 66;
77 static constexpr const int KEY_C = 67;
78 static constexpr const int KEY_D = 68;
79 static constexpr const int KEY_E = 69;
80 static constexpr const int KEY_F = 70;
81 static constexpr const int KEY_G = 71;
82 static constexpr const int KEY_H = 72;
83 static constexpr const int KEY_I = 73;
84 static constexpr const int KEY_J = 74;
85 static constexpr const int KEY_K = 75;
86 static constexpr const int KEY_L = 76;
87 static constexpr const int KEY_M = 77;
88 static constexpr const int KEY_N = 78;
89 static constexpr const int KEY_O = 79;
90 static constexpr const int KEY_P = 80;
91 static constexpr const int KEY_Q = 81;
92 static constexpr const int KEY_R = 82;
93 static constexpr const int KEY_S = 83;
94 static constexpr const int KEY_T = 84;
95 static constexpr const int KEY_U = 85;
96 static constexpr const int KEY_V = 86;
97 static constexpr const int KEY_W = 87;
98 static constexpr const int KEY_X = 88;
99 static constexpr const int KEY_Y = 89;
100 static constexpr const int KEY_Z = 90;
101 static constexpr const int KEY_LEFT_BRACKET = 91; /* [ */
102 static constexpr const int KEY_BACKSLASH = 92;
103 static constexpr const int KEY_RIGHT_BRACKET = 93; /* ] */
104 static constexpr const int KEY_GRAVE_ACCENT = 96; /* ` */
105 static constexpr const int KEY_WORLD_1 = 161; /* non-US #1 */
106 static constexpr const int KEY_WORLD_2 = 162; /* non-US #2 */
107
108 /* Function keys */
109 static constexpr const int KEY_ESCAPE = 256;
110 static constexpr const int KEY_ENTER = 257;
111 static constexpr const int KEY_TAB = 258;
112 static constexpr const int KEY_BACKSPACE = 259;
113 static constexpr const int KEY_INSERT = 260;
114 static constexpr const int KEY_DELETE = 261;
115 static constexpr const int KEY_RIGHT = 262;
116 static constexpr const int KEY_LEFT = 263;
117 static constexpr const int KEY_DOWN = 264;
118 static constexpr const int KEY_UP = 265;
119 static constexpr const int KEY_PAGE_UP = 266;
120 static constexpr const int KEY_PAGE_DOWN = 267;
121 static constexpr const int KEY_HOME = 268;
122 static constexpr const int KEY_END = 269;
123 static constexpr const int KEY_CAPS_LOCK = 280;
124 static constexpr const int KEY_SCROLL_LOCK = 281;
125 static constexpr const int KEY_NUM_LOCK = 282;
126 static constexpr const int KEY_PRINT_SCREEN = 283;
127 static constexpr const int KEY_PAUSE = 284;
128 static constexpr const int KEY_F1 = 290;
129 static constexpr const int KEY_F2 = 291;
130 static constexpr const int KEY_F3 = 292;
131 static constexpr const int KEY_F4 = 293;
132 static constexpr const int KEY_F5 = 294;
133 static constexpr const int KEY_F6 = 295;
134 static constexpr const int KEY_F7 = 296;
135 static constexpr const int KEY_F8 = 297;
136 static constexpr const int KEY_F9 = 298;
137 static constexpr const int KEY_F10 = 299;
138 static constexpr const int KEY_F11 = 300;
139 static constexpr const int KEY_F12 = 301;
140 static constexpr const int KEY_F13 = 302;
141 static constexpr const int KEY_F14 = 303;
142 static constexpr const int KEY_F15 = 304;
143 static constexpr const int KEY_F16 = 305;
144 static constexpr const int KEY_F17 = 306;
145 static constexpr const int KEY_F18 = 307;
146 static constexpr const int KEY_F19 = 308;
147 static constexpr const int KEY_F20 = 309;
148 static constexpr const int KEY_F21 = 310;
149 static constexpr const int KEY_F22 = 311;
150 static constexpr const int KEY_F23 = 312;
151 static constexpr const int KEY_F24 = 313;
152 static constexpr const int KEY_F25 = 314;
153 static constexpr const int KEY_KP_0 = 320;
154 static constexpr const int KEY_KP_1 = 321;
155 static constexpr const int KEY_KP_2 = 322;
156 static constexpr const int KEY_KP_3 = 323;
157 static constexpr const int KEY_KP_4 = 324;
158 static constexpr const int KEY_KP_5 = 325;
159 static constexpr const int KEY_KP_6 = 326;
160 static constexpr const int KEY_KP_7 = 327;
161 static constexpr const int KEY_KP_8 = 328;
162 static constexpr const int KEY_KP_9 = 329;
163 static constexpr const int KEY_KP_DECIMAL = 330;
164 static constexpr const int KEY_KP_DIVIDE = 331;
165 static constexpr const int KEY_KP_MULTIPLY = 332;
166 static constexpr const int KEY_KP_SUBTRACT = 333;
167 static constexpr const int KEY_KP_ADD = 334;
168 static constexpr const int KEY_KP_ENTER = 335;
169 static constexpr const int KEY_KP_EQUAL = 336;
170 static constexpr const int KEY_LEFT_SHIFT = 340;
171 static constexpr const int KEY_LEFT_CONTROL = 341;
172 static constexpr const int KEY_LEFT_ALT = 342;
173 static constexpr const int KEY_LEFT_SUPER = 343;
174 static constexpr const int KEY_RIGHT_SHIFT = 344;
175 static constexpr const int KEY_RIGHT_CONTROL = 345;
176 static constexpr const int KEY_RIGHT_ALT = 346;
177 static constexpr const int KEY_RIGHT_SUPER = 347;
178 static constexpr const int KEY_MENU = 348;
179 };
180
186 {
187 /* Common mouse buttons */
188 static constexpr const int BUTTON_LEFT = 0;
189 static constexpr const int BUTTON_RIGHT = 1;
190 static constexpr const int BUTTON_MIDDLE = 2;
191
192 /* Extended mouse buttons */
193 static constexpr const int BUTTON_4 = 3;
194 static constexpr const int BUTTON_5 = 4;
195 static constexpr const int BUTTON_6 = 5;
196 static constexpr const int BUTTON_7 = 6;
197 static constexpr const int BUTTON_8 = 7;
198 };
199
201 {
202 struct
203 {
204 int error;
205 const char* message;
206 } device_error;
207
208 struct
209 {
210 int key;
211 int scancode;
212 int action;
213 int mods;
214 } key_input;
215
216 struct
217 {
218 unsigned int character;
219 } char_input;
220
221 struct
222 {
223 double xpos;
224 double ypos;
225 } mouse_move;
226
227 struct
228 {
229 int entered;
230 } mouse_enter_window;
231
232 struct
233 {
234 double xoffset;
235 double yoffset;
236 } mouse_scroll;
237
238 struct
239 {
240 int button;
241 int action;
242 int mods;
243 } mouse_button;
244
245 struct
246 {
247 int width;
248 int height;
249 } resize;
250
251 struct
252 {
253 void* data;
254 } custom;
255 };
256
257 using EventList = std::vector<std::pair<EventType, EventData>>;
258}
259
260#endif
Core functionality (windows, event handler, logger, ...)
Definition cursor.h:8
EventType
Definition event_type.h:9
@ FRAMEBUFFER_RESIZE
Main framebuffer resized resized.
@ MOUSE_ENTER_WINDOW
Mouse cursor entered application window.
@ MOUSE_BUTTON
Mouse button clicked.
@ MOUSE_MOVE
Mouse moved.
@ ALL
Not an event type per se but can by used as a symbolic constant to represent All / Any events.
@ CUSTOM
Custom event which can be filled by user.
@ MOUSE_SCROLL
Mouse scroll event.
@ WINDOW_RESIZE
Application window resized.
@ CHAR_INPUT
Keyboard character input.
@ DEVICE_ERROR
Device generated an error.
@ KEY_INPUT
Keyboard key input.
Definition event_type.h:49
static constexpr const int KEY_UNKNOWN
Symbolic constant for an unknown key.
Definition event_type.h:50
static constexpr const int KEY_2
Numeric key 2 below function keys.
Definition event_type.h:65
static constexpr const int KEY_EQUAL
Equal key =
Definition event_type.h:74
static constexpr const int KEY_KP_6
Numeric key 6 on keypad.
Definition event_type.h:159
static constexpr const int KEY_KP_7
Numeric key 7 on keypad.
Definition event_type.h:160
static constexpr const int KEY_5
Numeric key 5 below function keys.
Definition event_type.h:68
static constexpr const int KEY_0
Numeric key 0 below function keys.
Definition event_type.h:63
static constexpr const int KEY_3
Numeric key 3 below function keys.
Definition event_type.h:66
static constexpr const int KEY_KP_2
Numeric key 2 on keypad.
Definition event_type.h:155
static constexpr const int KEY_KP_9
Numeric key 9 on keypad.
Definition event_type.h:162
static constexpr const int KEY_COMMA
Comma key ,
Definition event_type.h:58
static constexpr const int KEY_SEMICOLON
Semicolon key ;
Definition event_type.h:73
static constexpr const int KEY_MINUS
Minus key -
Definition event_type.h:59
static constexpr const int KEY_KP_3
Numeric key 3 on keypad.
Definition event_type.h:156
static constexpr const int KEY_KP_1
Numeric key 1 on keypad.
Definition event_type.h:154
static constexpr const int KEY_6
Numeric key 6 below function keys.
Definition event_type.h:69
static constexpr const int KEY_SPACE
Space bar.
Definition event_type.h:56
static constexpr const int KEY_9
Numeric key 9 below function keys.
Definition event_type.h:72
static constexpr const int KEY_KP_4
Numeric key 4 on keypad.
Definition event_type.h:157
static constexpr const int KEY_APOSTROPHE
Apostrophe key '
Definition event_type.h:57
static constexpr const int KEY_7
Numeric key 7 below function keys.
Definition event_type.h:70
static constexpr const int KEY_LEFT_SUPER
Left Super key, also known as the logo key.
Definition event_type.h:173
static constexpr const int KEY_8
Numeric key 8 below function keys.
Definition event_type.h:71
static constexpr const int KEY_BACKSLASH
Backslash key \
Definition event_type.h:102
static constexpr const int KEY_1
Numeric key 1 below function keys.
Definition event_type.h:64
static constexpr const int KEY_PERIOD
Period key .
Definition event_type.h:60
static constexpr const int KEY_KP_8
Numeric key 8 on keypad.
Definition event_type.h:161
static constexpr const int KEY_RIGHT_SUPER
Right Super key, also known as the logo key.
Definition event_type.h:177
static constexpr const int KEY_NONE
Not a real key, it will never be sent in events. Can be used in user code to represent a binding not ...
Definition event_type.h:52
static constexpr const int KEY_SLASH
Slash key /
Definition event_type.h:62
static constexpr const int KEY_4
Numeric key 4 below function keys.
Definition event_type.h:67
static constexpr const int KEY_KP_0
Numeric key 0 on keypad.
Definition event_type.h:153
static constexpr const int KEY_KP_5
Numeric key 5 on keypad.
Definition event_type.h:158
Definition event_type.h:186
Definition event_type.h:201