Event.hpp
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
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_HPP
26 #define SFML_EVENT_HPP
27 
29 // Headers
31 #include <SFML/Config.hpp>
32 #include <SFML/Window/Joystick.hpp>
33 #include <SFML/Window/Keyboard.hpp>
34 #include <SFML/Window/Mouse.hpp>
35 
36 
37 namespace sf
38 {
43 class Event
44 {
45 public :
46 
51  struct SizeEvent
52  {
53  unsigned int width;
54  unsigned int height;
55  };
56 
61  struct KeyEvent
62  {
64  bool alt;
65  bool control;
66  bool shift;
67  bool system;
68  };
69 
74  struct TextEvent
75  {
76  Uint32 unicode;
77  };
78 
84  {
85  int x;
86  int y;
87  };
88 
95  {
97  int x;
98  int y;
99  };
100 
106  {
107  int delta;
108  int x;
109  int y;
110  };
111 
118  {
119  unsigned int joystickId;
120  };
121 
127  {
128  unsigned int joystickId;
130  float position;
131  };
132 
139  {
140  unsigned int joystickId;
141  unsigned int button;
142  };
143 
149  {
168 
170  };
171 
173  // Member data
176 
177  union
178  {
188  };
189 };
190 
191 } // namespace sf
192 
193 
194 #endif // SFML_EVENT_HPP
195 
196 
Uint32 unicode
UTF-32 unicode value of the character.
Definition: Event.hpp:76
Size events parameters (Resized)
Definition: Event.hpp:51
TextEvent text
Text event parameters (Event::TextEntered)
Definition: Event.hpp:181
JoystickButtonEvent joystickButton
Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased) ...
Definition: Event.hpp:186
unsigned int width
New width, in pixels.
Definition: Event.hpp:53
Key
Key codes.
Definition: Keyboard.hpp:48
bool alt
Is the Alt key pressed?
Definition: Event.hpp:64
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1])
Definition: Event.hpp:128
A joystick was connected (data in event.joystickConnect)
Definition: Event.hpp:166
The window was resized (data in event.size)
Definition: Event.hpp:151
Joystick::Axis axis
Axis on which the joystick moved.
Definition: Event.hpp:129
Joystick axis move event parameters (JoystickMoved)
Definition: Event.hpp:126
MouseWheelEvent mouseWheel
Mouse wheel event parameters (Event::MouseWheelMoved)
Definition: Event.hpp:184
Mouse::Button button
Code of the button that has been pressed.
Definition: Event.hpp:96
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition: Event.hpp:98
A key was pressed (data in event.key)
Definition: Event.hpp:155
unsigned int height
New height, in pixels.
Definition: Event.hpp:54
A joystick was disconnected (data in event.joystickConnect)
Definition: Event.hpp:167
The window lost the focus (no data)
Definition: Event.hpp:152
MouseButtonEvent mouseButton
Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased) ...
Definition: Event.hpp:183
Joystick connection events parameters (JoystickConnected, JoystickDisconnected)
Definition: Event.hpp:117
Keep last – the total number of event types.
Definition: Event.hpp:169
Mouse wheel events parameters (MouseWheelMoved)
Definition: Event.hpp:105
Button
Mouse buttons.
Definition: Mouse.hpp:51
SizeEvent size
Size event parameters (Event::Resized)
Definition: Event.hpp:179
Mouse buttons events parameters (MouseButtonPressed, MouseButtonReleased)
Definition: Event.hpp:94
int delta
Number of ticks the wheel has moved (positive is up, negative is down)
Definition: Event.hpp:107
JoystickMoveEvent joystickMove
Joystick move event parameters (Event::JoystickMoved)
Definition: Event.hpp:185
A joystick button was released (data in event.joystickButton)
Definition: Event.hpp:164
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition: Event.hpp:109
The window requested to be closed (no data)
Definition: Event.hpp:150
A key was released (data in event.key)
Definition: Event.hpp:156
JoystickConnectEvent joystickConnect
Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected) ...
Definition: Event.hpp:187
Text event parameters (TextEntered)
Definition: Event.hpp:74
bool shift
Is the Shift key pressed?
Definition: Event.hpp:66
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition: Event.hpp:108
Mouse move event parameters (MouseMoved)
Definition: Event.hpp:83
KeyEvent key
Key event parameters (Event::KeyPressed, Event::KeyReleased)
Definition: Event.hpp:180
The window gained the focus (no data)
Definition: Event.hpp:153
float position
New position on the axis (in range [-100 .. 100])
Definition: Event.hpp:130
The mouse cursor entered the area of the window (no data)
Definition: Event.hpp:161
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1])
Definition: Event.hpp:119
unsigned int button
Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1]) ...
Definition: Event.hpp:141
The joystick moved along an axis (data in event.joystickMove)
Definition: Event.hpp:165
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition: Event.hpp:97
Joystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased) ...
Definition: Event.hpp:138
A mouse button was released (data in event.mouseButton)
Definition: Event.hpp:159
EventType
Enumeration of the different types of events.
Definition: Event.hpp:148
Keyboard::Key code
Code of the key that has been pressed.
Definition: Event.hpp:63
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition: Event.hpp:86
A joystick button was pressed (data in event.joystickButton)
Definition: Event.hpp:163
A character was entered (data in event.text)
Definition: Event.hpp:154
The mouse cursor left the area of the window (no data)
Definition: Event.hpp:162
MouseMoveEvent mouseMove
Mouse move event parameters (Event::MouseMoved)
Definition: Event.hpp:182
Keyboard event parameters (KeyPressed, KeyReleased)
Definition: Event.hpp:61
bool system
Is the System key pressed?
Definition: Event.hpp:67
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1])
Definition: Event.hpp:140
EventType type
Type of the event.
Definition: Event.hpp:175
bool control
Is the Control key pressed?
Definition: Event.hpp:65
The mouse wheel was scrolled (data in event.mouseWheel)
Definition: Event.hpp:157
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition: Event.hpp:85
A mouse button was pressed (data in event.mouseButton)
Definition: Event.hpp:158
Defines a system event and its parameters.
Definition: Event.hpp:43
The mouse cursor moved (data in event.mouseMove)
Definition: Event.hpp:160
Axis
Axes supported by SFML joysticks.
Definition: Joystick.hpp:59