CSFML - C binding of the Simple and Fast Multimedia Library

CSFML

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Event.h
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2018 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
sfJoystickButtonEvent
Joystick buttons events parameters.
Definition: Event.h:164
sfJoystickConnectEvent
Joystick connection/disconnection event parameters.
Definition: Event.h:175
sfJoystickMoveEvent
Joystick axis move event parameters.
Definition: Event.h:152
sfKeyEvent
Keyboard event parameters.
Definition: Event.h:77
sfMouseButtonEvent
Mouse buttons events parameters.
Definition: Event.h:112
sfMouseMoveEvent
Mouse move event parameters.
Definition: Event.h:101
sfMouseWheelEvent
Mouse wheel events parameters.
Definition: Event.h:127
sfMouseWheelScrollEvent
Mouse wheel events parameters.
Definition: Event.h:139
sfSensorEvent
Sensor event parameters.
Definition: Event.h:208
sfSizeEvent
Size events parameters.
Definition: Event.h:185
sfTextEvent
Text event parameters.
Definition: Event.h:91
sfTouchEvent
Touch events parameters.
Definition: Event.h:196
sfEvent
sfEvent defines a system event and its parameters
Definition: Event.h:221
sfEvent::joystickConnect
sfJoystickConnectEvent joystickConnect
Joystick (dis)connect event parameters.
Definition: Event.h:232
sfEvent::key
sfKeyEvent key
Key event parameters.
Definition: Event.h:224
sfEvent::mouseMove
sfMouseMoveEvent mouseMove
Mouse move event parameters.
Definition: Event.h:226
sfEvent::touch
sfTouchEvent touch
Touch events parameters.
Definition: Event.h:233
sfEvent::size
sfSizeEvent size
Size event parameters.
Definition: Event.h:223
sfEvent::joystickButton
sfJoystickButtonEvent joystickButton
Joystick button event parameters.
Definition: Event.h:231
sfEvent::mouseWheel
sfMouseWheelEvent mouseWheel
Mouse wheel event parameters (deprecated)
Definition: Event.h:228
sfEvent::sensor
sfSensorEvent sensor
Sensor event parameters.
Definition: Event.h:234
sfEvent::joystickMove
sfJoystickMoveEvent joystickMove
Joystick move event parameters.
Definition: Event.h:230
sfEvent::mouseButton
sfMouseButtonEvent mouseButton
Mouse button event parameters.
Definition: Event.h:227
sfEvent::type
sfEventType type
Type of the event.
Definition: Event.h:222
sfEvent::mouseWheelScroll
sfMouseWheelScrollEvent mouseWheelScroll
Mouse wheel event parameters.
Definition: Event.h:229
sfEvent::text
sfTextEvent text
Text event parameters.
Definition: Event.h:225