Event.h
1
2//
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
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 sfBool alt;
81 sfBool control;
82 sfBool shift;
83 sfBool system;
85
90typedef struct
91{
92 sfEventType type;
93 sfUint32 unicode;
95
100typedef struct
101{
102 sfEventType type;
103 int x;
104 int y;
106
111typedef struct
112{
113 sfEventType type;
114 sfMouseButton button;
115 int x;
116 int y;
118
126typedef struct CSFML_DEPRECATED
127{
128 sfEventType type;
129 int delta;
130 int x;
131 int y;
133
138typedef struct
139{
140 sfEventType type;
141 sfMouseWheel wheel;
142 float delta;
143 int x;
144 int y;
146
151typedef struct
152{
153 sfEventType type;
154 unsigned int joystickId;
155 sfJoystickAxis axis;
156 float position;
158
163typedef struct
164{
165 sfEventType type;
166 unsigned int joystickId;
167 unsigned int button;
169
174typedef struct
175{
176 sfEventType type;
177 unsigned int joystickId;
179
184typedef struct
185{
186 sfEventType type;
187 unsigned int width;
188 unsigned int height;
190
195typedef struct
196{
197 sfEventType type;
198 unsigned int finger;
199 int x;
200 int y;
202
207typedef struct
208{
209 sfEventType type;
210 sfSensorType sensorType;
211 float x;
212 float y;
213 float z;
215
220typedef union
221{
222 sfEventType type;
235} sfEvent;
236
237
238#endif // SFML_EVENT_H
Joystick buttons events parameters.
Definition: Event.h:164
Joystick connection/disconnection event parameters.
Definition: Event.h:175
Joystick axis move event parameters.
Definition: Event.h:152
Keyboard event parameters.
Definition: Event.h:77
Mouse buttons events parameters.
Definition: Event.h:112
Mouse move event parameters.
Definition: Event.h:101
Mouse wheel events parameters.
Definition: Event.h:127
Mouse wheel events parameters.
Definition: Event.h:139
Sensor event parameters.
Definition: Event.h:208
Size events parameters.
Definition: Event.h:185
Text event parameters.
Definition: Event.h:91
Touch events parameters.
Definition: Event.h:196
sfEvent defines a system event and its parameters
Definition: Event.h:221
sfJoystickConnectEvent joystickConnect
Joystick (dis)connect event parameters.
Definition: Event.h:232
sfKeyEvent key
Key event parameters.
Definition: Event.h:224
sfMouseMoveEvent mouseMove
Mouse move event parameters.
Definition: Event.h:226
sfTouchEvent touch
Touch events parameters.
Definition: Event.h:233
sfSizeEvent size
Size event parameters.
Definition: Event.h:223
sfJoystickButtonEvent joystickButton
Joystick button event parameters.
Definition: Event.h:231
sfMouseWheelEvent mouseWheel
Mouse wheel event parameters (deprecated)
Definition: Event.h:228
sfSensorEvent sensor
Sensor event parameters.
Definition: Event.h:234
sfJoystickMoveEvent joystickMove
Joystick move event parameters.
Definition: Event.h:230
sfMouseButtonEvent mouseButton
Mouse button event parameters.
Definition: Event.h:227
sfEventType type
Type of the event.
Definition: Event.h:222
sfMouseWheelScrollEvent mouseWheelScroll
Mouse wheel event parameters.
Definition: Event.h:229
sfTextEvent text
Text event parameters.
Definition: Event.h:225