openMSX
Event.hh
Go to the documentation of this file.
1#ifndef EVENT_HH
2#define EVENT_HH
3
4#include "JoystickId.hh"
5#include "SDLKey.hh"
6#include "StringStorage.hh"
7#include "TclObject.hh"
8
9#include "static_vector.hh"
10#include "stl.hh"
11
12#include <cassert>
13#include <cstdint>
14#include <string>
15#include <utility>
16#include <variant>
17
18#include <SDL.h>
19
20namespace openmsx {
21
22class CliConnection;
23enum class EventType : uint8_t;
24
25// --- The actual event classes (the Event class refers to one of these) ---
26
27class EventBase {};
28
29class SdlEvent : public EventBase
30{
31public:
32 SdlEvent(const SDL_Event& e) : evt(e) {}
33 [[nodiscard]] const SDL_Event& getSdlEvent() const { return evt; }
34 [[nodiscard]] const SDL_CommonEvent& getCommonSdlEvent() const { return evt.common; }
35
36protected:
37 SDL_Event evt;
38};
39
40
41class KeyEvent : public SdlEvent
42{
43public:
44 [[nodiscard]] bool getRepeat() const { return evt.key.repeat; }
45 [[nodiscard]] SDL_Keycode getKeyCode() const { return evt.key.keysym.sym; }
46 [[nodiscard]] SDL_Scancode getScanCode() const { return evt.key.keysym.scancode; }
47 [[nodiscard]] uint16_t getModifiers() const { return evt.key.keysym.mod; }
48 [[nodiscard]] uint32_t getUnicode() const {
49 // HACK: repurposed 'unused' field as 'unicode' field
50 return evt.key.keysym.unused;
51 }
52 [[nodiscard]] SDLKey getKey() const { return SDLKey{evt.key.keysym, evt.type == SDL_KEYDOWN}; }
53
54protected:
55 KeyEvent(const SDL_Event& e) : SdlEvent(e) {}
56};
57
58class KeyUpEvent final : public KeyEvent
59{
60public:
61 explicit KeyUpEvent(const SDL_Event& e) : KeyEvent(e) {}
62
63 [[nodiscard]] static KeyUpEvent create(SDL_Keycode code, SDL_Keymod mod = KMOD_NONE) {
64 SDL_Event evt = {};
65 SDL_KeyboardEvent& e = evt.key;
66 e.type = SDL_KEYUP;
67 e.timestamp = SDL_GetTicks();
68 e.state = SDL_RELEASED;
69 e.keysym.sym = code;
70 e.keysym.mod = mod;
71 return KeyUpEvent(evt);
72 }
73};
74
75class KeyDownEvent final : public KeyEvent
76{
77public:
78 explicit KeyDownEvent(const SDL_Event& e) : KeyEvent(e) {}
79
80 [[nodiscard]] static KeyDownEvent create(SDL_Keycode code, SDL_Keymod mod = KMOD_NONE) {
81 SDL_Event evt = {};
82 SDL_KeyboardEvent& e = evt.key;
83 e.type = SDL_KEYDOWN;
84 e.timestamp = SDL_GetTicks();
85 e.state = SDL_PRESSED;
86 e.keysym.sym = code;
87 e.keysym.mod = mod;
88 return KeyDownEvent(evt);
89 }
90 [[nodiscard]] static KeyDownEvent create(uint32_t timestamp, unsigned unicode) {
91 SDL_Event evt = {};
92 SDL_KeyboardEvent& e = evt.key;
93 e.type = SDL_KEYDOWN;
94 e.timestamp = timestamp;
95 e.state = SDL_PRESSED;
96 e.keysym.sym = SDLK_UNKNOWN;
97 e.keysym.mod = KMOD_NONE;
98 e.keysym.unused = unicode;
99 return KeyDownEvent(evt);
100 }
101};
102
103
105{
106public:
107 [[nodiscard]] auto getButton() const { return evt.button.button; }
108
109protected:
110 explicit MouseButtonEvent(const SDL_Event& e)
111 : SdlEvent(e) {}
112};
113
115{
116public:
117 explicit MouseButtonUpEvent(const SDL_Event& e)
118 : MouseButtonEvent(e) {}
119};
120
122{
123public:
124 explicit MouseButtonDownEvent(const SDL_Event& e)
125 : MouseButtonEvent(e) {}
126};
127
128class MouseWheelEvent final : public SdlEvent
129{
130public:
131 MouseWheelEvent(const SDL_Event& e)
132 : SdlEvent(e) {}
133
134 [[nodiscard]] int getX() const { return normalize(evt.wheel.x); }
135 [[nodiscard]] int getY() const { return normalize(evt.wheel.y); }
136
137private:
138 [[nodiscard]] int normalize(int x) const {
139 return evt.wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? -x : x;
140 }
141};
142
143class MouseMotionEvent final : public SdlEvent
144{
145public:
146 MouseMotionEvent(const SDL_Event& e)
147 : SdlEvent(e) {}
148
149 [[nodiscard]] int getX() const { return evt.motion.xrel; }
150 [[nodiscard]] int getY() const { return evt.motion.yrel; }
151 [[nodiscard]] int getAbsX() const { return evt.motion.x; }
152 [[nodiscard]] int getAbsY() const { return evt.motion.y; }
153};
154
155
157{
158public:
159 [[nodiscard]] JoystickId getJoystick() const {
160 // SDL joystick instance ID has already been translated to an openMSX JoystickID
161 return JoystickId(evt.jbutton.which);
162 }
163
164protected:
165 explicit JoystickEvent(const SDL_Event& e)
166 : SdlEvent(e) {}
167};
168
170{
171public:
172 [[nodiscard]] unsigned getButton() const { return evt.jbutton.button; }
173
174protected:
175 JoystickButtonEvent(const SDL_Event& e)
176 : JoystickEvent(e) {}
177};
178
180{
181public:
182 JoystickButtonUpEvent(const SDL_Event& e)
183 : JoystickButtonEvent(e) {}
184};
185
187{
188public:
189 JoystickButtonDownEvent(const SDL_Event& e)
190 : JoystickButtonEvent(e) {}
191};
192
194{
195public:
196 static constexpr uint8_t X_AXIS = 0;
197 static constexpr uint8_t Y_AXIS = 1;
198
199 JoystickAxisMotionEvent(const SDL_Event& e)
200 : JoystickEvent(e) {}
201
202 [[nodiscard]] uint8_t getAxis() const { return evt.jaxis.axis; }
203 [[nodiscard]] int16_t getValue() const { return evt.jaxis.value; }
204};
205
206class JoystickHatEvent final : public JoystickEvent
207{
208public:
209 JoystickHatEvent(const SDL_Event& e)
210 : JoystickEvent(e) {}
211
212 [[nodiscard]] uint8_t getHat() const { return evt.jhat.hat; }
213 [[nodiscard]] uint8_t getValue() const { return evt.jhat.value; }
214};
215
216
217class WindowEvent : public SdlEvent
218{
219public:
220 explicit WindowEvent(const SDL_Event& e)
221 : SdlEvent(e) {}
222 [[nodiscard]] const SDL_WindowEvent& getSdlWindowEvent() const { return evt.window; }
223 [[nodiscard]] bool isMainWindow() const { return isMainWindow(evt.window.windowID); }
224
225public:
226 static void setMainWindowId(uint32_t id) { mainWindowId = id; }
227 static uint32_t getMainWindowId() { return mainWindowId; }
228 [[nodiscard]] static bool isMainWindow(unsigned id) { return id == mainWindowId; }
229private:
230 static inline uint32_t mainWindowId = unsigned(-1);
231};
232
233
234class TextEvent : public SdlEvent
235{
236public:
237 explicit TextEvent(const SDL_Event& e)
238 : SdlEvent(e) {}
239};
240
241
242class FileDropEvent final : public EventBase
243{
244public:
245 explicit FileDropEvent(std::string_view fileName_)
246 : fileName(allocate_c_string(fileName_)) {}
247 FileDropEvent(const FileDropEvent&) { assert(false); }
248 FileDropEvent& operator=(const FileDropEvent&) { assert(false); return *this; }
251
252 [[nodiscard]] zstring_view getFileName() const { return fileName.get(); }
253
254private:
255 StringStorage fileName;
256};
257
258
259class QuitEvent final : public EventBase {};
260
261
267{
268public:
271
272 [[nodiscard]] unsigned getButton() const { return button; }
273
274protected:
275 OsdControlEvent(unsigned button_)
276 : button(button_) {}
277
278private:
279 unsigned button;
280};
281
283{
284public:
285 explicit OsdControlReleaseEvent(unsigned button_)
286 : OsdControlEvent(button_) {}
287};
288
290{
291public:
292 explicit OsdControlPressEvent(unsigned button_)
293 : OsdControlEvent(button_) {}
294};
295
296
297class GroupEvent final : public EventBase
298{
299public:
300 GroupEvent(std::initializer_list<EventType> typesToMatch_, TclObject tclListComponents_)
301 : typesToMatch(typesToMatch_)
302 , tclListComponents(std::move(tclListComponents_)) {}
303
304 [[nodiscard]] const auto& getTypesToMatch() const { return typesToMatch; }
305 [[nodiscard]] const auto& getTclListComponents() const { return tclListComponents; }
306
307private:
308 static_vector<EventType, 3> typesToMatch;
309 TclObject tclListComponents;
310};
311
323class FinishFrameEvent final : public EventBase
324{
325public:
326 FinishFrameEvent(int thisSource_, int selectedSource_,
327 bool skipped_)
328 : thisSource(thisSource_), selectedSource(selectedSource_)
329 , skipped(skipped_)
330 {
331 }
332
333 [[nodiscard]] int getSource() const { return thisSource; }
334 [[nodiscard]] int getSelectedSource() const { return selectedSource; }
335 [[nodiscard]] bool isSkipped() const { return skipped; }
336 [[nodiscard]] bool needRender() const { return !skipped && (thisSource == selectedSource); }
337
338private:
339 int thisSource;
340 int selectedSource;
341 bool skipped;
342};
343
345class CliCommandEvent final : public EventBase
346{
347public:
348 CliCommandEvent(std::string_view command_, const CliConnection* id_)
349 : command(allocate_c_string(command_)), id(id_) {}
350 CliCommandEvent(const CliCommandEvent&) { assert(false); }
351 CliCommandEvent& operator=(const CliCommandEvent&) { assert(false); return *this; }
354
355 [[nodiscard]] zstring_view getCommand() const { return command.get(); }
356 [[nodiscard]] const CliConnection* getId() const { return id; }
357
358private:
359 StringStorage command;
360 const CliConnection* id;
361};
362
363class ImGuiActiveEvent final : public EventBase
364{
365public:
366 explicit ImGuiActiveEvent(bool active_)
367 : active(active_) {}
368 [[nodiscard]] bool getActive() const { return active; }
369
370private:
371 bool active;
372};
373
374
375// Events that don't need additional data
376class SimpleEvent : public EventBase {};
377
379class BootEvent final : public SimpleEvent {};
380
385class FrameDrawnEvent final : public SimpleEvent {};
386
387class BreakEvent final : public SimpleEvent {};
388class SwitchRendererEvent final : public SimpleEvent {};
389
391class TakeReverseSnapshotEvent final : public SimpleEvent {};
392
394class AfterTimedEvent final : public SimpleEvent {};
395
397class MachineLoadedEvent final : public SimpleEvent {};
398
401class MachineActivatedEvent final : public SimpleEvent {};
402class MachineDeactivatedEvent final : public SimpleEvent {};
403
404class MidiInReaderEvent final : public SimpleEvent {};
405class MidiInWindowsEvent final : public SimpleEvent {};
406class MidiInCoreMidiEvent final : public SimpleEvent {};
408class MidiInALSAEvent final : public SimpleEvent {};
409class Rs232TesterEvent final : public SimpleEvent {};
410class Rs232NetEvent final : public SimpleEvent {};
411class ImGuiDelayedActionEvent final : public SimpleEvent {};
412
413
414// --- Put all (non-abstract) Event classes into a std::variant ---
415
416using Event = std::variant<
430 TextEvent,
432 QuitEvent,
436 BootEvent,
454>;
455
456template<typename T>
457inline constexpr uint8_t event_index = get_index<T, Event>::value;
458
459
460// --- Define an enum for all concrete event types. ---
461// Use the numeric value from the corresponding index in the Event.
462enum class EventType : uint8_t
463{
464 KEY_UP = event_index<KeyUpEvent>,
465 KEY_DOWN = event_index<KeyDownEvent>,
466 MOUSE_MOTION = event_index<MouseMotionEvent>,
467 MOUSE_BUTTON_UP = event_index<MouseButtonUpEvent>,
468 MOUSE_BUTTON_DOWN = event_index<MouseButtonDownEvent>,
469 MOUSE_WHEEL = event_index<MouseWheelEvent>,
470 JOY_AXIS_MOTION = event_index<JoystickAxisMotionEvent>,
471 JOY_HAT = event_index<JoystickHatEvent>,
472 JOY_BUTTON_UP = event_index<JoystickButtonUpEvent>,
473 JOY_BUTTON_DOWN = event_index<JoystickButtonDownEvent>,
474 OSD_CONTROL_RELEASE = event_index<OsdControlReleaseEvent>,
475 OSD_CONTROL_PRESS = event_index<OsdControlPressEvent>,
476 WINDOW = event_index<WindowEvent>,
477 TEXT = event_index<TextEvent>,
478 FILE_DROP = event_index<FileDropEvent>,
479 QUIT = event_index<QuitEvent>,
480 GROUP = event_index<GroupEvent>,
481 BOOT = event_index<BootEvent>,
482 FINISH_FRAME = event_index<FinishFrameEvent>,
483 FRAME_DRAWN = event_index<FrameDrawnEvent>,
484 BREAK = event_index<BreakEvent>,
485 SWITCH_RENDERER = event_index<SwitchRendererEvent>,
486 TAKE_REVERSE_SNAPSHOT = event_index<TakeReverseSnapshotEvent>,
487 CLICOMMAND = event_index<CliCommandEvent>,
488 AFTER_TIMED = event_index<AfterTimedEvent>,
489 MACHINE_LOADED = event_index<MachineLoadedEvent>,
490 MACHINE_ACTIVATED = event_index<MachineActivatedEvent>,
491 MACHINE_DEACTIVATED = event_index<MachineDeactivatedEvent>,
492 MIDI_IN_READER = event_index<MidiInReaderEvent>,
493 MIDI_IN_WINDOWS = event_index<MidiInWindowsEvent>,
494 MIDI_IN_COREMIDI = event_index<MidiInCoreMidiEvent>,
495 MIDI_IN_COREMIDI_VIRTUAL = event_index<MidiInCoreMidiVirtualEvent>,
496 MIDI_IN_ALSA = event_index<MidiInALSAEvent>,
497 RS232_TESTER = event_index<Rs232TesterEvent>,
498 RS232_NET = event_index<Rs232NetEvent>,
499 IMGUI_DELAYED_ACTION = event_index<ImGuiDelayedActionEvent>,
500 IMGUI_ACTIVE = event_index<ImGuiActiveEvent>,
501
502 NUM_EVENT_TYPES // must be last
503};
504
505
506// --- Event class, free functions ---
507
508[[nodiscard]] EventType getType(const Event& event);
509
511[[nodiscard]] std::string toString(const Event& event);
512
514[[nodiscard]] TclObject toTclList(const Event& event);
515
516[[nodiscard]] bool operator==(const Event& x, const Event& y);
517
521[[nodiscard]] bool matches(const Event& self, const Event& other);
522
523
524// --- Event class implementation, free functions ---
525
526inline EventType getType(const Event& event)
527{
528 return EventType(event.index());
529}
530
531// Similar to std::get() and std::get_if()
532template<typename T>
533struct GetIfEventHelper { // standard std::get_if() behavior
534 const T* operator()(const Event& event) {
535 return std::get_if<T>(&event);
536 }
537};
538template<>
539struct GetIfEventHelper<SdlEvent> { // extension for base-classes
540 const SdlEvent* operator()(const Event& event) {
541 const auto& var = event;
542 switch (EventType(var.index())) {
543 case EventType::KEY_UP: return &std::get<KeyUpEvent>(var);
544 case EventType::KEY_DOWN: return &std::get<KeyDownEvent>(var);
545 case EventType::MOUSE_BUTTON_UP: return &std::get<MouseButtonUpEvent>(var);
546 case EventType::MOUSE_BUTTON_DOWN: return &std::get<MouseButtonDownEvent>(var);
547 case EventType::MOUSE_WHEEL: return &std::get<MouseWheelEvent>(var);
548 case EventType::MOUSE_MOTION: return &std::get<MouseMotionEvent>(var);
549 case EventType::JOY_BUTTON_UP: return &std::get<JoystickButtonUpEvent>(var);
550 case EventType::JOY_BUTTON_DOWN: return &std::get<JoystickButtonDownEvent>(var);
551 case EventType::JOY_AXIS_MOTION: return &std::get<JoystickAxisMotionEvent>(var);
552 case EventType::JOY_HAT: return &std::get<JoystickHatEvent>(var);
553 case EventType::WINDOW: return &std::get<WindowEvent>(var);
554 case EventType::TEXT: return &std::get<TextEvent>(var);
555 default: return nullptr;
556 }
557 }
558};
559template<>
561 const KeyEvent* operator()(const Event& event) {
562 const auto& var = event;
563 switch (EventType(var.index())) {
564 case EventType::KEY_UP: return &std::get<KeyUpEvent>(var);
565 case EventType::KEY_DOWN: return &std::get<KeyDownEvent>(var);
566 default: return nullptr;
567 }
568 }
569};
570template<>
572 const JoystickEvent* operator()(const Event& event) {
573 const auto& var = event;
574 switch (EventType(var.index())) {
575 case EventType::JOY_BUTTON_UP: return &std::get<JoystickButtonUpEvent>(var);
576 case EventType::JOY_BUTTON_DOWN: return &std::get<JoystickButtonDownEvent>(var);
577 case EventType::JOY_AXIS_MOTION: return &std::get<JoystickAxisMotionEvent>(var);
578 case EventType::JOY_HAT: return &std::get<JoystickHatEvent>(var);
579 default: return nullptr;
580 }
581 }
582};
583template<typename T>
584const T* get_event_if(const Event& event)
585{
586 GetIfEventHelper<T> helper;
587 return helper(event);
588}
589template<typename T>
590const T& get_event(const Event& event)
591{
592 const T* t = get_event_if<T>(event);
593 assert(t);
594 return *t;
595}
596
597} // namespace openmsx
598
599#endif
uintptr_t id
std::unique_ptr< char, FreeStringStorage > StringStorage
StringStorage allocate_c_string(std::string_view s)
Allocate memory for and copy a c-string (zero-terminated string).
TclObject t
Send when an after-EmuTime command should be executed.
Definition Event.hh:394
Sent when the MSX resets or powers up.
Definition Event.hh:379
Command received on CliComm connection.
Definition Event.hh:346
CliCommandEvent & operator=(CliCommandEvent &&)=default
const CliConnection * getId() const
Definition Event.hh:356
CliCommandEvent(CliCommandEvent &&)=default
zstring_view getCommand() const
Definition Event.hh:355
CliCommandEvent(const CliCommandEvent &)
Definition Event.hh:350
CliCommandEvent(std::string_view command_, const CliConnection *id_)
Definition Event.hh:348
CliCommandEvent & operator=(const CliCommandEvent &)
Definition Event.hh:351
FileDropEvent(std::string_view fileName_)
Definition Event.hh:245
FileDropEvent & operator=(const FileDropEvent &)
Definition Event.hh:248
zstring_view getFileName() const
Definition Event.hh:252
FileDropEvent(const FileDropEvent &)
Definition Event.hh:247
FileDropEvent & operator=(FileDropEvent &&)=default
FileDropEvent(FileDropEvent &&)=default
This event is send when a device (v99x8, v9990, video9000, laserdisc) reaches the end of a frame.
Definition Event.hh:324
FinishFrameEvent(int thisSource_, int selectedSource_, bool skipped_)
Definition Event.hh:326
int getSource() const
Definition Event.hh:333
bool isSkipped() const
Definition Event.hh:335
int getSelectedSource() const
Definition Event.hh:334
bool needRender() const
Definition Event.hh:336
Sent when a FINISH_FRAME caused a redraw of the screen.
Definition Event.hh:385
GroupEvent(std::initializer_list< EventType > typesToMatch_, TclObject tclListComponents_)
Definition Event.hh:300
const auto & getTypesToMatch() const
Definition Event.hh:304
const auto & getTclListComponents() const
Definition Event.hh:305
bool getActive() const
Definition Event.hh:368
ImGuiActiveEvent(bool active_)
Definition Event.hh:366
static constexpr uint8_t X_AXIS
Definition Event.hh:196
static constexpr uint8_t Y_AXIS
Definition Event.hh:197
JoystickAxisMotionEvent(const SDL_Event &e)
Definition Event.hh:199
JoystickButtonDownEvent(const SDL_Event &e)
Definition Event.hh:189
unsigned getButton() const
Definition Event.hh:172
JoystickButtonEvent(const SDL_Event &e)
Definition Event.hh:175
JoystickButtonUpEvent(const SDL_Event &e)
Definition Event.hh:182
JoystickEvent(const SDL_Event &e)
Definition Event.hh:165
JoystickId getJoystick() const
Definition Event.hh:159
JoystickHatEvent(const SDL_Event &e)
Definition Event.hh:209
uint8_t getValue() const
Definition Event.hh:213
uint8_t getHat() const
Definition Event.hh:212
static KeyDownEvent create(SDL_Keycode code, SDL_Keymod mod=KMOD_NONE)
Definition Event.hh:80
static KeyDownEvent create(uint32_t timestamp, unsigned unicode)
Definition Event.hh:90
KeyDownEvent(const SDL_Event &e)
Definition Event.hh:78
bool getRepeat() const
Definition Event.hh:44
SDL_Keycode getKeyCode() const
Definition Event.hh:45
KeyEvent(const SDL_Event &e)
Definition Event.hh:55
uint32_t getUnicode() const
Definition Event.hh:48
SDL_Scancode getScanCode() const
Definition Event.hh:46
uint16_t getModifiers() const
Definition Event.hh:47
SDLKey getKey() const
Definition Event.hh:52
static KeyUpEvent create(SDL_Keycode code, SDL_Keymod mod=KMOD_NONE)
Definition Event.hh:63
KeyUpEvent(const SDL_Event &e)
Definition Event.hh:61
Send when a machine is (de)activated.
Definition Event.hh:401
Send when a (new) machine configuration is loaded.
Definition Event.hh:397
MouseButtonDownEvent(const SDL_Event &e)
Definition Event.hh:124
auto getButton() const
Definition Event.hh:107
MouseButtonEvent(const SDL_Event &e)
Definition Event.hh:110
MouseButtonUpEvent(const SDL_Event &e)
Definition Event.hh:117
MouseMotionEvent(const SDL_Event &e)
Definition Event.hh:146
MouseWheelEvent(const SDL_Event &e)
Definition Event.hh:131
OSD events are triggered by other events.
Definition Event.hh:267
OsdControlEvent(unsigned button_)
Definition Event.hh:275
unsigned getButton() const
Definition Event.hh:272
OsdControlPressEvent(unsigned button_)
Definition Event.hh:292
OsdControlReleaseEvent(unsigned button_)
Definition Event.hh:285
const SDL_CommonEvent & getCommonSdlEvent() const
Definition Event.hh:34
SdlEvent(const SDL_Event &e)
Definition Event.hh:32
SDL_Event evt
Definition Event.hh:37
const SDL_Event & getSdlEvent() const
Definition Event.hh:33
Used to schedule 'taking reverse snapshots' between Z80 instructions.
Definition Event.hh:391
TextEvent(const SDL_Event &e)
Definition Event.hh:237
static uint32_t getMainWindowId()
Definition Event.hh:227
bool isMainWindow() const
Definition Event.hh:223
const SDL_WindowEvent & getSdlWindowEvent() const
Definition Event.hh:222
static void setMainWindowId(uint32_t id)
Definition Event.hh:226
static bool isMainWindow(unsigned id)
Definition Event.hh:228
WindowEvent(const SDL_Event &e)
Definition Event.hh:220
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:9
constexpr uint8_t event_index
Definition Event.hh:457
EventType
Definition Event.hh:463
const T * get_event_if(const Event &event)
Definition Event.hh:584
bool operator==(const BooleanInput &x, const BooleanInput &y)
bool matches(const Event &self, const Event &other)
Does this event 'match' the given event.
Definition Event.cc:210
TclObject toTclList(const Event &event)
Similar to toString(), but retains the structure of the event.
Definition Event.cc:101
EventType getType(const Event &event)
Definition Event.hh:526
std::string toString(const BooleanInput &input)
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:454
const T & get_event(const Event &event)
Definition Event.hh:590
STL namespace.
const JoystickEvent * operator()(const Event &event)
Definition Event.hh:572
const KeyEvent * operator()(const Event &event)
Definition Event.hh:561
const SdlEvent * operator()(const Event &event)
Definition Event.hh:540
const T * operator()(const Event &event)
Definition Event.hh:534