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