GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
Event.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Ivar Härnqvist
2// SPDX-License-Identifier: MIT
3
4#ifndef GREM_EVENTS_EVENT_HPP
5#define GREM_EVENTS_EVENT_HPP
6
8
11#include <GREM/core/extents.hpp>
13#include <GREM/core/math.hpp>
15#include <GREM/events/Input.hpp>
18#include <GREM/events/mouse.hpp>
19
20namespace grem::events {
21
26
29
32 uint32_t displayID;
33};
34
37 uint32_t windowID;
38};
39
42 uint32_t windowID;
43};
44
58
63
70
74 uint8_t clickCount;
75
81 [[nodiscard]] Input getInput() const noexcept;
82};
83
88
94
106
115
120
123
126
133
136
141
144
147
150
153
156
159
162
165
168
171
176
181
186
189
192
195
198
201
204
207
210
215
218
221
224
227
233
236
239
242
245
250
253
256
259
262
265
268
271
274
277
280
283
286
289
292
297
302
305
308
317struct Event
318 : Variant< //
319 ApplicationQuitRequestedEvent, //
320 DisplayOrientationChangedEvent, //
321 DisplayAddedEvent, //
322 DisplayRemovedEvent, //
323 DisplayMovedEvent, //
324 DisplayDesktopModeChangedEvent, //
325 DisplayCurrentModeChangedEvent, //
326 DisplayContentScaleChangedEvent, //
327 DisplayUsableBoundsChangedEvent, //
328 WindowShownEvent, //
329 WindowHiddenEvent, //
330 WindowExposedEvent, //
331 WindowMovedEvent, //
332 WindowResizedEvent, //
333 WindowDrawableSizeChangedEvent, //
334 WindowMinimizedEvent, //
335 WindowMaximizedEvent, //
336 WindowRestoredEvent, //
337 WindowMouseFocusGainedEvent, //
338 WindowMouseFocusLostEvent, //
339 WindowKeyboardFocusGainedEvent, //
340 WindowKeyboardFocusLostEvent, //
341 WindowCloseRequestedEvent, //
342 WindowDisplayChangedEvent, //
343 WindowDisplayScaleChangedEvent, //
344 KeyPressedEvent, //
345 KeyPressRepeatedEvent, //
346 KeyReleasedEvent, //
347 TextInputEditedEvent, //
348 TextInputSubmittedEvent, //
349 MouseMovedEvent, //
350 MouseButtonPressedEvent, //
351 MouseButtonReleasedEvent, //
352 MouseWheelScrolledEvent, //
353 ControllerAddedEvent, //
354 ControllerRemovedEvent, //
355 ControllerRemappedEvent, //
356 ControllerAxisMovedEvent, //
357 ControllerButtonPressedEvent, //
358 ControllerButtonReleasedEvent, //
359 TouchMovedEvent, //
360 TouchPressedEvent, //
361 TouchReleasedEvent, //
362 PinchBeginEvent, //
363 PinchUpdateEvent, //
364 PinchEndEvent, //
365 KeymapChangedEvent, //
366 ClipboardUpdatedEvent, //
367 DroppedFileEvent, //
368 DroppedTextEvent, //
369 DropStartedEvent, //
370 DropCompletedEvent> {};
371
372} // namespace grem::events
373
374#endif
Set of key modifiers.
Definition keyboard.hpp:579
Definition controller.hpp:11
MouseButton
Physical mouse button identifier.
Definition mouse.hpp:18
ControllerAxis
Physical controller axis identifier.
Definition controller.hpp:65
Input
General identifier for a specific control on a physical input device, such as a certain keyboard key,...
Definition Input.hpp:182
Scancode
Number corresponding to a physical keyboard key location, ignoring the OS-level key mapping.
Definition keyboard.hpp:299
KeyCode
Number corresponding to an abstract keyboard key that was translated from its physical location based...
Definition keyboard.hpp:26
ControllerButton
Physical controller button identifier.
Definition controller.hpp:38
vec< 2, float > vec2
Definition math.hpp:438
Clock::time_point TimePoint
Definition Clock.hpp:26
Extent< 2 > Extent2D
Size of a 2D data region.
Definition extents.hpp:31
Offset< 2 > Offset2D
Offset in a 2D data region.
Definition extents.hpp:21
StringBase< char, std::char_traits< char >, std::allocator< char > > String
Definition String.hpp:17
Application Event base.
Definition Event.hpp:28
Application was requested to quit by the user.
Definition Event.hpp:135
Clipboard Event base.
Definition Event.hpp:125
Clipboard was updated.
Definition Event.hpp:291
Controller was added.
Definition Event.hpp:252
Controller axis Event base.
Definition Event.hpp:90
int16_t axisValue
Current axis value in the range [-32768, 32767].
Definition Event.hpp:92
ControllerAxis axis
Physical controller axis.
Definition Event.hpp:91
Controller axis was moved.
Definition Event.hpp:261
Controller button Event base.
Definition Event.hpp:96
ControllerButton controllerButton
Physical controller button.
Definition Event.hpp:97
Input getInput() const noexcept
Get the general identifier of the physical controller button input.
Controller button was pressed.
Definition Event.hpp:264
Controller button was released.
Definition Event.hpp:267
Controller Event base.
Definition Event.hpp:85
uint32_t controllerID
Unique identifier of the controller instance.
Definition Event.hpp:86
Controller was remapped.
Definition Event.hpp:258
Controller was removed.
Definition Event.hpp:255
Display was added.
Definition Event.hpp:143
Display changed content scale.
Definition Event.hpp:158
Display changed current mode.
Definition Event.hpp:155
Display changed desktop mode.
Definition Event.hpp:152
Display Event base.
Definition Event.hpp:31
uint32_t displayID
Unique identifier of the display.
Definition Event.hpp:32
Display was moved.
Definition Event.hpp:149
Display orientation changed.
Definition Event.hpp:138
int orientation
New display orientation.
Definition Event.hpp:139
Display was added.
Definition Event.hpp:146
Display changed usable bounds.
Definition Event.hpp:161
Drop was completed.
Definition Event.hpp:307
Drop Event base.
Definition Event.hpp:128
uint32_t windowID
Unique identifier of the window that was dropped onto, if any.
Definition Event.hpp:129
vec2 position
Relative position in the window where the drop event took place.
Definition Event.hpp:130
String source
Source application that sent this drop event, or empty if unavailable.
Definition Event.hpp:131
Drop was started.
Definition Event.hpp:304
File was dropped.
Definition Event.hpp:294
String droppedFilepath
Filepath of the dropped file.
Definition Event.hpp:295
Text was dropped.
Definition Event.hpp:299
String droppedText
Dropped text.
Definition Event.hpp:300
Event base.
Definition Event.hpp:23
TimePoint timestamp
Timestamp of the event.
Definition Event.hpp:24
Data structure containing information about an event.
Definition Event.hpp:370
Input Event base.
Definition Event.hpp:41
uint32_t windowID
Unique identifier of the window that this event belongs to, if any.
Definition Event.hpp:42
Keyboard key Event base.
Definition Event.hpp:46
KeyModifiers keyModifiers
Current key modifiers.
Definition Event.hpp:49
Scancode scancode
Scancode of the physical key location.
Definition Event.hpp:47
KeyCode keyCode
Virtual key code, based on the user's current OS-level key mapping.
Definition Event.hpp:48
Input getInput() const noexcept
Get the general identifier of the physical key input.
Keyboard key was held, causing a repeat press.
Definition Event.hpp:223
Keyboard key was pressed.
Definition Event.hpp:220
Keyboard key was released.
Definition Event.hpp:226
Keyboard keymap was changed.
Definition Event.hpp:288
Keyboard keymap Event base.
Definition Event.hpp:122
Mouse button Event base.
Definition Event.hpp:72
uint8_t clickCount
Number of consecutive clicks within a short time interval.
Definition Event.hpp:74
MouseButton mouseButton
Physical mouse button.
Definition Event.hpp:73
Input getInput() const noexcept
Get the general identifier of the physical mouse button input.
Mouse button was pressed.
Definition Event.hpp:241
Mouse button was released.
Definition Event.hpp:244
Mouse Event base.
Definition Event.hpp:65
vec2 relativeMouseMotion
Position offset relative to the previous position.
Definition Event.hpp:68
vec2 mousePosition
Current mouse position in the window.
Definition Event.hpp:67
uint32_t mouseID
Unique identifier of the mouse instance, or 0xFFFFFFFF if it was emulated by touch input,...
Definition Event.hpp:66
Mouse was moved.
Definition Event.hpp:238
Mouse wheel was scrolled.
Definition Event.hpp:247
vec2 scrollAmount
Amount scrolled horizontally/vertically, with floating-point precision.
Definition Event.hpp:248
Finger pinch started.
Definition Event.hpp:279
Finger pinch ended.
Definition Event.hpp:285
Pinch Event base.
Definition Event.hpp:117
float scale
Scale change since the last PinchUpdateEvent. Scale <1 is "zoom out", >1 is "zoom in".
Definition Event.hpp:118
Finger pinch was updated.
Definition Event.hpp:282
Text input was edited.
Definition Event.hpp:229
int32_t textCursorOffset
The cursor offset of the start of the selected text.
Definition Event.hpp:230
int32_t textCursorSelectionLength
The length of the current text selection, if any.
Definition Event.hpp:231
Text input Event base.
Definition Event.hpp:60
String inputText
Input text.
Definition Event.hpp:61
Text input was submitted.
Definition Event.hpp:235
Touch Event base.
Definition Event.hpp:108
uint64_t touchDeviceID
Touch device identifier.
Definition Event.hpp:109
float normalizedFingerPressure
Amount of pressure applied, normalized to the range [0, 1].
Definition Event.hpp:113
vec2 normalizedFingerPosition
Current finger position, normalized to the range [0, 1].
Definition Event.hpp:111
vec2 relativeNormalizedFingerMotion
Finger offset relative to the previous position, normalized to the range [-1, 1].
Definition Event.hpp:112
uint64_t fingerID
Finger identifier, or 0xFFFFFFFF if it was emulated by mouse input.
Definition Event.hpp:110
Finger touch was moved.
Definition Event.hpp:270
Finger touch was pressed.
Definition Event.hpp:273
Finger touch was released.
Definition Event.hpp:276
Window was requested to close.
Definition Event.hpp:209
Window was moved to a new display.
Definition Event.hpp:212
uint32_t displayID
Unique identifier of the display that the window was moved to.
Definition Event.hpp:213
Window display scale changed.
Definition Event.hpp:217
Window drawable size was changed.
Definition Event.hpp:183
Extent2D windowDrawableSize
New drawable window size.
Definition Event.hpp:184
Window Event base.
Definition Event.hpp:36
uint32_t windowID
Unique identifier of the window.
Definition Event.hpp:37
Window was exposed.
Definition Event.hpp:170
Window was hidden.
Definition Event.hpp:167
Window gained keyboard focus.
Definition Event.hpp:203
Window lost keyboard focus.
Definition Event.hpp:206
Window was maximized.
Definition Event.hpp:191
Window was minimized.
Definition Event.hpp:188
Window gained mouse focus.
Definition Event.hpp:197
Window lost mouse focus.
Definition Event.hpp:200
Window was moved.
Definition Event.hpp:173
Offset2D windowPosition
New window position.
Definition Event.hpp:174
Window was resized.
Definition Event.hpp:178
Extent2D windowSize
New window size.
Definition Event.hpp:179
Window was restored.
Definition Event.hpp:194
Window was shown.
Definition Event.hpp:164