CSFML - C binding of the Simple and Fast Multimedia Library

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