Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
window_events.hpp
1
/***
2
* @file window_events.hpp
3
* @author Xein
4
* @date 06 May 25
5
* @brief All the different events a window may have
6
*/
7
8
#pragma once
9
#include <toast/events/event.hpp>
10
11
namespace
event {
12
13
constexpr
int
window_input_released = 0;
14
constexpr
int
window_input_pressed = 1;
15
constexpr
int
window_input_repeated = 2;
16
17
constexpr
int
window_input_device_disconnected = 0;
18
constexpr
int
window_input_device_connected = 1;
19
21
struct
ExitApplication
: Event<ExitApplication> { };
22
24
struct
WindowClose : Event<WindowClose> {
25
uint32_t window_id;
26
27
explicit
WindowClose(uint32_t window_id) : window_id(window_id) { }
28
};
29
31
struct
WindowDrop : Event<WindowDrop> {
33
std::vector<std::string>
files
;
34
35
explicit
WindowDrop(std::vector<std::string>&& input_files) :
files
(std::move(input_files)) { }
36
};
37
39
struct
WindowKey : Event<WindowKey> {
40
int
key
;
41
int
scancode
;
42
int
action
;
43
int
mods
;
44
45
WindowKey(
int
key
,
int
scancode
,
int
action
,
int
mods
) :
key
(
key
),
scancode
(
scancode
),
action
(
action
),
mods
(
mods
) { }
46
};
47
49
struct
WindowChar : Event<WindowChar> {
50
unsigned
key;
51
52
WindowChar(
unsigned
key) : key(key) { }
53
};
54
56
struct
WindowMousePosition : Event<WindowMousePosition> {
57
float
x, y;
58
59
WindowMousePosition(
float
x_pos,
float
y_pos) : x(x_pos), y(y_pos) { }
60
};
61
63
struct
WindowMouseButton : Event<WindowMouseButton> {
64
int
button, action, mods;
65
66
WindowMouseButton(
int
button,
int
action,
int
mods) : button(button), action(action), mods(mods) { }
67
};
68
70
struct
WindowMouseScroll : Event<WindowMouseScroll> {
71
float
x, y;
72
73
WindowMouseScroll(
float
x_offset,
float
y_offset) : x(x_offset), y(y_offset) { }
74
};
75
84
struct
WindowResize : Event<WindowResize> {
85
int
width, height;
86
87
WindowResize(
int
width,
int
height) : width(width), height(height) { }
88
};
89
91
struct
WindowDisplayScale : Event<WindowDisplayScale> {
92
float
scale;
93
94
explicit
WindowDisplayScale(
float
scale) : scale(scale) { }
95
};
96
97
struct
WindowMouseLock : Event<WindowMouseLock> {
98
bool
locked;
99
100
explicit
WindowMouseLock(
bool
locked) : locked(locked) { }
101
};
102
104
struct
WindowFocus : Event<WindowFocus> {
105
bool
focused;
106
107
explicit
WindowFocus(
bool
focused) : focused(focused) { }
108
};
109
110
}
event::ExitApplication
Send this event to tell the engine to close the window.
Definition
window_events.hpp:21
event::WindowDrop::files
std::vector< std::string > files
Path to the files thrown to the window.
Definition
window_events.hpp:33
event::WindowKey::key
int key
SDL key code.
Definition
window_events.hpp:40
event::WindowKey::action
int action
0 released, 1 pressed, 2 repeated
Definition
window_events.hpp:42
event::WindowKey::mods
int mods
Modifier flags.
Definition
window_events.hpp:43
event::WindowKey::scancode
int scancode
SDL scancode.
Definition
window_events.hpp:41
engine
src
toast
window
window_events.hpp
Generated by
1.17.0