Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
ui-event.h
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3#pragma once
4
5#include "flint/input/event.h"
6#include "flint/math/types.h"
7
8#include <SDL3/SDL_keycode.h>
9
10namespace Flint {
16 enum class UIEventType {
17 None,
18 MouseMove,
19 MouseButtonDown,
20 MouseButtonUp,
21 KeyDown,
22 KeyUp,
23 NavigateUp,
24 NavigateDown,
25 NavigateLeft,
26 NavigateRight,
27 Submit,
28 Cancel
29 };
30
38 enum class UIInputSource {
39 Unknown,
40 Mouse,
41 Keyboard,
42 Gamepad
43 };
44
51 struct UIEvent {
52 UIEventType type = UIEventType::None;
53 UIInputSource source = UIInputSource::Unknown;
56 int mouseButton = 0;
57 SDL_Keycode keycode =
58 SDLK_UNKNOWN;
59 };
60
70 [[nodiscard]] UIEvent toUiEvent(const AppEvent &event);
71
72}
A tagged union representing a single application input or window event.
Definition event.h:90
Vec2f mousePosition
Definition ui-event.h:55
SDL_Keycode keycode
Definition ui-event.h:57
UIInputSource source
Definition ui-event.h:53
UIEventType type
Definition ui-event.h:52
A normalized data packet containing translated input data routed down the UI node tree.
Definition ui-event.h:51