Toast Engine
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
11namespace event {
12
13constexpr int window_input_released = 0;
14constexpr int window_input_pressed = 1;
15constexpr int window_input_repeated = 2;
16
17constexpr int window_input_device_disconnected = 0;
18constexpr int window_input_device_connected = 1;
19
21struct ExitApplication : Event<ExitApplication> { };
22
24struct WindowClose : Event<WindowClose> {
25 uint32_t window_id;
26
27 explicit WindowClose(uint32_t window_id) : window_id(window_id) { }
28};
29
31struct 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
39struct WindowKey : Event<WindowKey> {
40 int key;
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
49struct WindowChar : Event<WindowChar> {
50 unsigned key;
51
52 WindowChar(unsigned key) : key(key) { }
53};
54
56struct WindowMousePosition : Event<WindowMousePosition> {
57 float x, y;
58
59 WindowMousePosition(float x_pos, float y_pos) : x(x_pos), y(y_pos) { }
60};
61
63struct 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
70struct WindowMouseScroll : Event<WindowMouseScroll> {
71 float x, y;
72
73 WindowMouseScroll(float x_offset, float y_offset) : x(x_offset), y(y_offset) { }
74};
75
84struct WindowResize : Event<WindowResize> {
85 int width, height;
86
87 WindowResize(int width, int height) : width(width), height(height) { }
88};
89
91struct WindowDisplayScale : Event<WindowDisplayScale> {
92 float scale;
93
94 explicit WindowDisplayScale(float scale) : scale(scale) { }
95};
96
97struct WindowMouseLock : Event<WindowMouseLock> {
98 bool locked;
99
100 explicit WindowMouseLock(bool locked) : locked(locked) { }
101};
102
104struct WindowFocus : Event<WindowFocus> {
105 bool focused;
106
107 explicit WindowFocus(bool focused) : focused(focused) { }
108};
109
110}
Send this event to tell the engine to close the window.
Definition window_events.hpp:21
std::vector< std::string > files
Path to the files thrown to the window.
Definition window_events.hpp:33
int key
SDL key code.
Definition window_events.hpp:40
int action
0 released, 1 pressed, 2 repeated
Definition window_events.hpp:42
int mods
Modifier flags.
Definition window_events.hpp:43
int scancode
SDL scancode.
Definition window_events.hpp:41