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
10
namespace
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;
55
Vec2f
mousePosition
{};
56
int
mouseButton
= 0;
57
SDL_Keycode
keycode
=
58
SDLK_UNKNOWN;
59
};
60
70
[[nodiscard]]
UIEvent
toUiEvent(
const
AppEvent
&event);
71
72
}
Flint::AppEvent
A tagged union representing a single application input or window event.
Definition
event.h:90
Flint::UIEvent::mousePosition
Vec2f mousePosition
Definition
ui-event.h:55
Flint::UIEvent::keycode
SDL_Keycode keycode
Definition
ui-event.h:57
Flint::UIEvent::source
UIInputSource source
Definition
ui-event.h:53
Flint::UIEvent::type
UIEventType type
Definition
ui-event.h:52
Flint::UIEvent::mouseButton
int mouseButton
Definition
ui-event.h:56
Flint::UIEvent
A normalized data packet containing translated input data routed down the UI node tree.
Definition
ui-event.h:51
Flint::Vec2< float >
include
flint
ui
ui-event.h
Generated by
1.12.0