blob: d5ddf0a2673dd16cd0c2101dbc8a235524ea8cf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#pragma once
#include <string>
#include "KeyCodes.h"
/**
* \brief Base class for all event types in the system.
*/
class Event {
public:
};
/**
* \brief Event triggered when a key is pressed.
*/
class KeyPressEvent : public Event {
public:
//! Number of times the key press is repeated (e.g., for long presses).
int repeat = 0;
//! The key that was pressed.
Keycode key = Keycode::NONE;
};
/**
* \brief Event triggered when a key is released.
*/
class KeyReleaseEvent : public Event {
public:
//! The key that was released.
Keycode key = Keycode::NONE;
};
/**
* \brief Event triggered when a mouse button is pressed.
*/
class MousePressEvent : public Event {
public:
//! X-coordinate of the mouse position at the time of the event.
int mouse_x = 0;
//! Y-coordinate of the mouse position at the time of the event.
int mouse_y = 0;
//! The mouse button that was pressed.
MouseButton button = MouseButton::NONE;
};
/**
* \brief Event triggered when a mouse button is clicked (press and release).
*/
class MouseClickEvent : public Event {
public:
//! X-coordinate of the mouse position at the time of the event.
int mouse_x = 0;
//! Y-coordinate of the mouse position at the time of the event.
int mouse_y = 0;
//! The mouse button that was clicked.
MouseButton button = MouseButton::NONE;
};
/**
* \brief Event triggered when a mouse button is released.
*/
class MouseReleaseEvent : public Event {
public:
//! X-coordinate of the mouse position at the time of the event.
int mouse_x = 0;
//! Y-coordinate of the mouse position at the time of the event.
int mouse_y = 0;
//! The mouse button that was released.
MouseButton button = MouseButton::NONE;
};
/**
* \brief Event triggered when the mouse is moved.
*/
class MouseMoveEvent : public Event {
public:
//! X-coordinate of the mouse position at the time of the event.
int mouse_x = 0;
//! Y-coordinate of the mouse position at the time of the event.
int mouse_y = 0;
};
/**
* \brief Event triggered during a collision between objects.
*/
class CollisionEvent : public Event {
public:
//! Data describing the collision (currently not implemented).
// Collision collisionData;
};
/**
* \brief Event triggered when text is submitted, e.g., from a text input.
*/
class TextSubmitEvent : public Event {
public:
//! The submitted text.
std::string text = "";
};
/**
* \brief Event triggered to indicate the application is shutting down.
*/
class ShutDownEvent : public Event {
public:
};
|