Event.h
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef SFML_EVENT_H
26#define SFML_EVENT_H
27
29// Headers
31#include <SFML/Window/Export.h>
32#include <SFML/Window/Joystick.h>
33#include <SFML/Window/Keyboard.h>
34#include <SFML/Window/Mouse.h>
35#include <SFML/Window/Sensor.h>
36
37
42typedef enum
43{
44 sfEvtClosed,
45 sfEvtResized,
46 sfEvtLostFocus,
47 sfEvtGainedFocus,
48 sfEvtTextEntered,
49 sfEvtKeyPressed,
50 sfEvtKeyReleased,
51 sfEvtMouseWheelMoved,
52 sfEvtMouseWheelScrolled,
53 sfEvtMouseButtonPressed,
54 sfEvtMouseButtonReleased,
55 sfEvtMouseMoved,
56 sfEvtMouseEntered,
57 sfEvtMouseLeft,
58 sfEvtJoystickButtonPressed,
59 sfEvtJoystickButtonReleased,
60 sfEvtJoystickMoved,
61 sfEvtJoystickConnected,
62 sfEvtJoystickDisconnected,
63 sfEvtTouchBegan,
64 sfEvtTouchMoved,
65 sfEvtTouchEnded,
66 sfEvtSensorChanged,
67
68 sfEvtCount
69} sfEventType;
70
71
76typedef struct
77{
78 sfEventType type;
79 sfKeyCode code;
80 sfScancode scancode;
81 sfBool alt;
82 sfBool control;
83 sfBool shift;
84 sfBool system;
86
91typedef struct
92{
93 sfEventType type;
94 sfUint32 unicode;
96
101typedef struct
102{
103 sfEventType type;
104 int x;
105 int y;
107
112typedef struct
113{
114 sfEventType type;
115 sfMouseButton button;
116 int x;
117 int y;
119
127typedef struct CSFML_DEPRECATED
128{
129 sfEventType type;
130 int delta;
131 int x;
132 int y;
134
139typedef struct
140{
141 sfEventType type;
142 sfMouseWheel wheel;
143 float delta;
144 int x;
145 int y;
147
152typedef struct
153{
154 sfEventType type;
155 unsigned int joystickId;
156 sfJoystickAxis axis;
157 float position;
159
164typedef struct
165{
166 sfEventType type;
167 unsigned int joystickId;
168 unsigned int button;
170
175typedef struct
176{
177 sfEventType type;
178 unsigned int joystickId;
180
185typedef struct
186{
187 sfEventType type;
188 unsigned int width;
189 unsigned int height;
191
196typedef struct
197{
198 sfEventType type;
199 unsigned int finger;
200 int x;
201 int y;
203
208typedef struct
209{
210 sfEventType type;
211 sfSensorType sensorType;
212 float x;
213 float y;
214 float z;
216
221typedef union
222{
223 sfEventType type;
236} sfEvent;
237
238
239#endif // SFML_EVENT_H
Joystick buttons events parameters.
Definition Event.h:165
Joystick connection/disconnection event parameters.
Definition Event.h:176
Joystick axis move event parameters.
Definition Event.h:153
Keyboard event parameters.
Definition Event.h:77
Mouse buttons events parameters.
Definition Event.h:113
Mouse move event parameters.
Definition Event.h:102
Mouse wheel events parameters.
Definition Event.h:128
Mouse wheel events parameters.
Definition Event.h:140
Sensor event parameters.
Definition Event.h:209
Size events parameters.
Definition Event.h:186
Text event parameters.
Definition Event.h:92
Touch events parameters.
Definition Event.h:197
sfEvent defines a system event and its parameters
Definition Event.h:222
sfJoystickConnectEvent joystickConnect
Joystick (dis)connect event parameters.
Definition Event.h:233
sfKeyEvent key
Key event parameters.
Definition Event.h:225
sfMouseMoveEvent mouseMove
Mouse move event parameters.
Definition Event.h:227
sfTouchEvent touch
Touch events parameters.
Definition Event.h:234
sfSizeEvent size
Size event parameters.
Definition Event.h:224
sfJoystickButtonEvent joystickButton
Joystick button event parameters.
Definition Event.h:232
sfMouseWheelEvent mouseWheel
Mouse wheel event parameters (deprecated)
Definition Event.h:229
sfSensorEvent sensor
Sensor event parameters.
Definition Event.h:235
sfJoystickMoveEvent joystickMove
Joystick move event parameters.
Definition Event.h:231
sfMouseButtonEvent mouseButton
Mouse button event parameters.
Definition Event.h:228
sfEventType type
Type of the event.
Definition Event.h:223
sfMouseWheelScrollEvent mouseWheelScroll
Mouse wheel event parameters.
Definition Event.h:230
sfTextEvent text
Text event parameters.
Definition Event.h:226