Learn
Download
Community
Development
Home
»
Learn
»
2.1 Documentation
»
Event.hpp Source File
Français
Donate
Documentation of SFML 2.1
Warning:
this page refers to an old version of SFML. Click here to switch to the latest version.
Main Page
Modules
Classes
Files
File List
sfml
sfml
include
SFML
Window
Event.hpp
1
2
//
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
{
63
Keyboard::Key
code
;
64
bool
alt
;
65
bool
control
;
66
bool
shift
;
67
bool
system
;
68
};
69
74
struct
TextEvent
75
{
76
Uint32
unicode
;
77
};
78
83
struct
MouseMoveEvent
84
{
85
int
x
;
86
int
y
;
87
};
88
94
struct
MouseButtonEvent
95
{
96
Mouse::Button
button
;
97
int
x
;
98
int
y
;
99
};
100
105
struct
MouseWheelEvent
106
{
107
int
delta
;
108
int
x
;
109
int
y
;
110
};
111
117
struct
JoystickConnectEvent
118
{
119
unsigned
int
joystickId
;
120
};
121
126
struct
JoystickMoveEvent
127
{
128
unsigned
int
joystickId
;
129
Joystick::Axis
axis
;
130
float
position
;
131
};
132
138
struct
JoystickButtonEvent
139
{
140
unsigned
int
joystickId
;
141
unsigned
int
button
;
142
};
143
148
enum
EventType
149
{
150
Closed
,
151
Resized
,
152
LostFocus
,
153
GainedFocus
,
154
TextEntered
,
155
KeyPressed
,
156
KeyReleased
,
157
MouseWheelMoved
,
158
MouseButtonPressed
,
159
MouseButtonReleased
,
160
MouseMoved
,
161
MouseEntered
,
162
MouseLeft
,
163
JoystickButtonPressed
,
164
JoystickButtonReleased
,
165
JoystickMoved
,
166
JoystickConnected
,
167
JoystickDisconnected
,
168
169
Count
170
};
171
173
// Member data
175
EventType
type
;
176
177
union
178
{
179
SizeEvent
size
;
180
KeyEvent
key
;
181
TextEvent
text
;
182
MouseMoveEvent
mouseMove
;
183
MouseButtonEvent
mouseButton
;
184
MouseWheelEvent
mouseWheel
;
185
JoystickMoveEvent
joystickMove
;
186
JoystickButtonEvent
joystickButton
;
187
JoystickConnectEvent
joystickConnect
;
188
};
189
};
190
191
}
// namespace sf
192
193
194
#endif // SFML_EVENT_HPP
195
196