CSFML - C binding of the Simple and Fast Multimedia Library

CSFML 2.6.1

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 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
42 typedef 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
76 typedef struct
77{
78 sfEventType type;
79 sfKeyCode code;
80 sfScancode scancode;
81 sfBool alt;
82 sfBool control;
83 sfBool shift;
84 sfBool system;
85} sfKeyEvent;
86
91 typedef struct
92{
93 sfEventType type;
94 sfUint32 unicode;
95} sfTextEvent;
96
101 typedef struct
102{
103 sfEventType type;
104 int x;
105 int y;
106} sfMouseMoveEvent;
107
112 typedef struct
113{
114 sfEventType type;
115 sfMouseButton button;
116 int x;
117 int y;
118} sfMouseButtonEvent;
119
127 typedef struct CSFML_DEPRECATED
128{
129 sfEventType type;
130 int delta;
131 int x;
132 int y;
133} sfMouseWheelEvent;
134
139 typedef struct
140{
141 sfEventType type;
142 sfMouseWheel wheel;
143 float delta;
144 int x;
145 int y;
146} sfMouseWheelScrollEvent;
147
152 typedef struct
153{
154 sfEventType type;
155 unsigned int joystickId;
156 sfJoystickAxis axis;
157 float position;
158} sfJoystickMoveEvent;
159
164 typedef struct
165{
166 sfEventType type;
167 unsigned int joystickId;
168 unsigned int button;
169} sfJoystickButtonEvent;
170
175 typedef struct
176{
177 sfEventType type;
178 unsigned int joystickId;
179} sfJoystickConnectEvent;
180
185 typedef struct
186{
187 sfEventType type;
188 unsigned int width;
189 unsigned int height;
190} sfSizeEvent;
191
196 typedef struct
197{
198 sfEventType type;
199 unsigned int finger;
200 int x;
201 int y;
202} sfTouchEvent;
203
208 typedef struct
209{
210 sfEventType type;
211 sfSensorType sensorType;
212 float x;
213 float y;
214 float z;
215} sfSensorEvent;
216
221 typedef union
222{
223 sfEventType type;
224 sfSizeEvent size;
225 sfKeyEvent key;
226 sfTextEvent text;
227 sfMouseMoveEvent mouseMove;
228 sfMouseButtonEvent mouseButton;
229 sfMouseWheelEvent mouseWheel;
230 sfMouseWheelScrollEvent mouseWheelScroll;
231 sfJoystickMoveEvent joystickMove;
232 sfJoystickButtonEvent joystickButton;
233 sfJoystickConnectEvent joystickConnect;
234 sfTouchEvent touch;
235 sfSensorEvent sensor;
236} sfEvent;
237
238
239#endif // SFML_EVENT_H
sfUint32
unsigned int sfUint32
Definition Config.h:176
sfBool
int sfBool
Definition Config.h:153
CSFML_DEPRECATED
#define CSFML_DEPRECATED
Definition Config.h:146
sfEventType
sfEventType
Definition of all the event types.
Definition Event.h:43
sfEvtCount
@ sfEvtCount
Keep last – the total number of event types.
Definition Event.h:68
sfEvtKeyPressed
@ sfEvtKeyPressed
A key was pressed (data in event.key)
Definition Event.h:49
sfEvtClosed
@ sfEvtClosed
The window requested to be closed (no data)
Definition Event.h:44
sfEvtJoystickButtonReleased
@ sfEvtJoystickButtonReleased
A joystick button was released (data in event.joystickButton)
Definition Event.h:59
sfEvtJoystickConnected
@ sfEvtJoystickConnected
A joystick was connected (data in event.joystickConnect)
Definition Event.h:61
sfEvtSensorChanged
@ sfEvtSensorChanged
A sensor value changed (data in event.sensor)
Definition Event.h:66
sfEvtJoystickDisconnected
@ sfEvtJoystickDisconnected
A joystick was disconnected (data in event.joystickConnect)
Definition Event.h:62
sfEvtTextEntered
@ sfEvtTextEntered
A character was entered (data in event.text)
Definition Event.h:48
sfEvtMouseWheelScrolled
@ sfEvtMouseWheelScrolled
The mouse wheel was scrolled (data in event.mouseWheelScroll)
Definition Event.h:52
sfEvtJoystickMoved
@ sfEvtJoystickMoved
The joystick moved along an axis (data in event.joystickMove)
Definition Event.h:60
sfEvtMouseLeft
@ sfEvtMouseLeft
The mouse cursor left the area of the window (no data)
Definition Event.h:57
sfEvtMouseEntered
@ sfEvtMouseEntered
The mouse cursor entered the area of the window (no data)
Definition Event.h:56
sfEvtMouseButtonPressed
@ sfEvtMouseButtonPressed
A mouse button was pressed (data in event.mouseButton)
Definition Event.h:53
sfEvtMouseButtonReleased
@ sfEvtMouseButtonReleased
A mouse button was released (data in event.mouseButton)
Definition Event.h:54
sfEvtGainedFocus
@ sfEvtGainedFocus
The window gained the focus (no data)
Definition Event.h:47
sfEvtMouseMoved
@ sfEvtMouseMoved
The mouse cursor moved (data in event.mouseMove)
Definition Event.h:55
sfEvtKeyReleased
@ sfEvtKeyReleased
A key was released (data in event.key)
Definition Event.h:50
sfEvtResized
@ sfEvtResized
The window was resized (data in event.size)
Definition Event.h:45
sfEvtTouchEnded
@ sfEvtTouchEnded
A touch event ended (data in event.touch)
Definition Event.h:65
sfEvtTouchBegan
@ sfEvtTouchBegan
A touch event began (data in event.touch)
Definition Event.h:63
sfEvtTouchMoved
@ sfEvtTouchMoved
A touch moved (data in event.touch)
Definition Event.h:64
sfEvtJoystickButtonPressed
@ sfEvtJoystickButtonPressed
A joystick button was pressed (data in event.joystickButton)
Definition Event.h:58
sfEvtMouseWheelMoved
@ sfEvtMouseWheelMoved
The mouse wheel was scrolled (data in event.mouseWheel) (deprecated)
Definition Event.h:51
sfEvtLostFocus
@ sfEvtLostFocus
The window lost the focus (no data)
Definition Event.h:46
Joystick.h
sfJoystickAxis
sfJoystickAxis
Axes supported by SFML joysticks.
Definition Joystick.h:52
Keyboard.h
sfScancode
sfScancode
Scancodes.
Definition Keyboard.h:170
sfKeyCode
sfKeyCode
Key codes.
Definition Keyboard.h:43
Mouse.h
sfMouseWheel
sfMouseWheel
Mouse wheels.
Definition Mouse.h:56
sfMouseButton
sfMouseButton
Mouse buttons.
Definition Mouse.h:41
Sensor.h
sfSensorType
sfSensorType
Sensor Types.
Definition Sensor.h:41
Export.h
sfJoystickButtonEvent
Joystick buttons events parameters.
Definition Event.h:165
sfJoystickButtonEvent::type
sfEventType type
Definition Event.h:166
sfJoystickButtonEvent::joystickId
unsigned int joystickId
Definition Event.h:167
sfJoystickButtonEvent::button
unsigned int button
Definition Event.h:168
sfJoystickConnectEvent
Joystick connection/disconnection event parameters.
Definition Event.h:176
sfJoystickConnectEvent::joystickId
unsigned int joystickId
Definition Event.h:178
sfJoystickConnectEvent::type
sfEventType type
Definition Event.h:177
sfJoystickMoveEvent
Joystick axis move event parameters.
Definition Event.h:153
sfJoystickMoveEvent::axis
sfJoystickAxis axis
Definition Event.h:156
sfJoystickMoveEvent::position
float position
Definition Event.h:157
sfJoystickMoveEvent::type
sfEventType type
Definition Event.h:154
sfJoystickMoveEvent::joystickId
unsigned int joystickId
Definition Event.h:155
sfKeyEvent
Keyboard event parameters.
Definition Event.h:77
sfKeyEvent::system
sfBool system
Definition Event.h:84
sfKeyEvent::shift
sfBool shift
Definition Event.h:83
sfKeyEvent::alt
sfBool alt
Definition Event.h:81
sfKeyEvent::type
sfEventType type
Definition Event.h:78
sfKeyEvent::control
sfBool control
Definition Event.h:82
sfKeyEvent::scancode
sfScancode scancode
Definition Event.h:80
sfKeyEvent::code
sfKeyCode code
Definition Event.h:79
sfMouseButtonEvent
Mouse buttons events parameters.
Definition Event.h:113
sfMouseButtonEvent::x
int x
Definition Event.h:116
sfMouseButtonEvent::y
int y
Definition Event.h:117
sfMouseButtonEvent::type
sfEventType type
Definition Event.h:114
sfMouseButtonEvent::button
sfMouseButton button
Definition Event.h:115
sfMouseMoveEvent
Mouse move event parameters.
Definition Event.h:102
sfMouseMoveEvent::y
int y
Definition Event.h:105
sfMouseMoveEvent::x
int x
Definition Event.h:104
sfMouseMoveEvent::type
sfEventType type
Definition Event.h:103
sfMouseWheelEvent
Mouse wheel events parameters.
Definition Event.h:128
sfMouseWheelEvent::type
sfEventType type
Definition Event.h:129
sfMouseWheelEvent::x
int x
Definition Event.h:131
sfMouseWheelEvent::delta
int delta
Definition Event.h:130
sfMouseWheelEvent::y
int y
Definition Event.h:132
sfMouseWheelScrollEvent
Mouse wheel events parameters.
Definition Event.h:140
sfMouseWheelScrollEvent::delta
float delta
Definition Event.h:143
sfMouseWheelScrollEvent::wheel
sfMouseWheel wheel
Definition Event.h:142
sfMouseWheelScrollEvent::type
sfEventType type
Definition Event.h:141
sfMouseWheelScrollEvent::y
int y
Definition Event.h:145
sfMouseWheelScrollEvent::x
int x
Definition Event.h:144
sfSensorEvent
Sensor event parameters.
Definition Event.h:209
sfSensorEvent::sensorType
sfSensorType sensorType
Definition Event.h:211
sfSensorEvent::y
float y
Definition Event.h:213
sfSensorEvent::x
float x
Definition Event.h:212
sfSensorEvent::z
float z
Definition Event.h:214
sfSensorEvent::type
sfEventType type
Definition Event.h:210
sfSizeEvent
Size events parameters.
Definition Event.h:186
sfSizeEvent::height
unsigned int height
Definition Event.h:189
sfSizeEvent::type
sfEventType type
Definition Event.h:187
sfSizeEvent::width
unsigned int width
Definition Event.h:188
sfTextEvent
Text event parameters.
Definition Event.h:92
sfTextEvent::unicode
sfUint32 unicode
Definition Event.h:94
sfTextEvent::type
sfEventType type
Definition Event.h:93
sfTouchEvent
Touch events parameters.
Definition Event.h:197
sfTouchEvent::type
sfEventType type
Definition Event.h:198
sfTouchEvent::y
int y
Definition Event.h:201
sfTouchEvent::x
int x
Definition Event.h:200
sfTouchEvent::finger
unsigned int finger
Definition Event.h:199
sfEvent
sfEvent defines a system event and its parameters
Definition Event.h:222
sfEvent::joystickConnect
sfJoystickConnectEvent joystickConnect
Joystick (dis)connect event parameters.
Definition Event.h:233
sfEvent::key
sfKeyEvent key
Key event parameters.
Definition Event.h:225
sfEvent::mouseMove
sfMouseMoveEvent mouseMove
Mouse move event parameters.
Definition Event.h:227
sfEvent::touch
sfTouchEvent touch
Touch events parameters.
Definition Event.h:234
sfEvent::size
sfSizeEvent size
Size event parameters.
Definition Event.h:224
sfEvent::joystickButton
sfJoystickButtonEvent joystickButton
Joystick button event parameters.
Definition Event.h:232
sfEvent::mouseWheel
sfMouseWheelEvent mouseWheel
Mouse wheel event parameters (deprecated)
Definition Event.h:229
sfEvent::sensor
sfSensorEvent sensor
Sensor event parameters.
Definition Event.h:235
sfEvent::joystickMove
sfJoystickMoveEvent joystickMove
Joystick move event parameters.
Definition Event.h:231
sfEvent::mouseButton
sfMouseButtonEvent mouseButton
Mouse button event parameters.
Definition Event.h:228
sfEvent::type
sfEventType type
Type of the event.
Definition Event.h:223
sfEvent::mouseWheelScroll
sfMouseWheelScrollEvent mouseWheelScroll
Mouse wheel event parameters.
Definition Event.h:230
sfEvent::text
sfTextEvent text
Text event parameters.
Definition Event.h:226