Learn
Download
Community
Development
Home
»
Learn
»
1.6 Documentation
»
Event.hpp Source File
Français
Donate
Documentation of SFML 1.6
Warning:
this page refers to an old version of SFML. Click here to switch to the latest version.
Main Page
Namespaces
Classes
Files
File List
sfml
sfml
include
SFML
Window
Event.hpp
1
2
//
3
// SFML - Simple and Fast Multimedia Library
4
// Copyright (C) 2007-2009 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
33
34
namespace
sf
35
{
39
namespace
Key
40
{
41
enum
Code
42
{
43
A =
'a'
,
44
B =
'b'
,
45
C =
'c'
,
46
D =
'd'
,
47
E =
'e'
,
48
F =
'f'
,
49
G =
'g'
,
50
H =
'h'
,
51
I =
'i'
,
52
J =
'j'
,
53
K =
'k'
,
54
L =
'l'
,
55
M =
'm'
,
56
N =
'n'
,
57
O =
'o'
,
58
P =
'p'
,
59
Q =
'q'
,
60
R =
'r'
,
61
S =
's'
,
62
T =
't'
,
63
U =
'u'
,
64
V =
'v'
,
65
W =
'w'
,
66
X =
'x'
,
67
Y =
'y'
,
68
Z =
'z'
,
69
Num0 =
'0'
,
70
Num1 =
'1'
,
71
Num2 =
'2'
,
72
Num3 =
'3'
,
73
Num4 =
'4'
,
74
Num5 =
'5'
,
75
Num6 =
'6'
,
76
Num7 =
'7'
,
77
Num8 =
'8'
,
78
Num9 =
'9'
,
79
Escape = 256,
80
LControl,
81
LShift,
82
LAlt,
83
LSystem
,
84
RControl,
85
RShift,
86
RAlt,
87
RSystem
,
88
Menu,
89
LBracket
,
90
RBracket
,
91
SemiColon
,
92
Comma
,
93
Period
,
94
Quote
,
95
Slash
,
96
BackSlash,
97
Tilde
,
98
Equal
,
99
Dash
,
100
Space,
101
Return,
102
Back,
103
Tab,
104
PageUp,
105
PageDown,
106
End,
107
Home,
108
Insert,
109
Delete,
110
Add
,
111
Subtract
,
112
Multiply
,
113
Divide
,
114
Left
,
115
Right
,
116
Up
,
117
Down
,
118
Numpad0,
119
Numpad1,
120
Numpad2,
121
Numpad3,
122
Numpad4,
123
Numpad5,
124
Numpad6,
125
Numpad7,
126
Numpad8,
127
Numpad9,
128
F1,
129
F2,
130
F3,
131
F4,
132
F5,
133
F6,
134
F7,
135
F8,
136
F9,
137
F10,
138
F11,
139
F12,
140
F13,
141
F14,
142
F15,
143
Pause,
144
145
Count
// Keep last -- total number of keyboard keys
146
};
147
}
148
149
153
namespace
Mouse
154
{
155
enum
Button
156
{
157
Left,
158
Right,
159
Middle,
160
XButton1,
161
XButton2,
162
163
ButtonCount
// Keep last -- total number of mouse buttons
164
};
165
}
166
167
171
namespace
Joy
172
{
173
enum
Axis
174
{
175
AxisX,
176
AxisY,
177
AxisZ,
178
AxisR,
179
AxisU,
180
AxisV,
181
AxisPOV,
182
183
AxisCount
// Keep last -- total number of joystick axis
184
};
185
186
enum
187
{
188
Count
= 4,
189
ButtonCount
= 32
190
};
191
}
192
193
197
class
Event
198
{
199
public
:
200
204
struct
KeyEvent
205
{
206
Key::Code
Code;
207
bool
Alt;
208
bool
Control;
209
bool
Shift;
210
};
211
215
struct
TextEvent
216
{
217
Uint32
Unicode
;
218
};
219
223
struct
MouseMoveEvent
224
{
225
int
X;
226
int
Y;
227
};
228
232
struct
MouseButtonEvent
233
{
234
Mouse::Button Button;
235
int
X;
236
int
Y;
237
};
238
242
struct
MouseWheelEvent
243
{
244
int
Delta;
245
};
246
250
struct
JoyMoveEvent
251
{
252
unsigned
int
JoystickId;
253
Joy::Axis Axis;
254
float
Position;
255
};
256
260
struct
JoyButtonEvent
261
{
262
unsigned
int
JoystickId;
263
unsigned
int
Button;
264
};
265
269
struct
SizeEvent
270
{
271
unsigned
int
Width;
272
unsigned
int
Height;
273
};
274
278
enum
EventType
279
{
280
Closed,
281
Resized,
282
LostFocus,
283
GainedFocus,
284
TextEntered,
285
KeyPressed,
286
KeyReleased,
287
MouseWheelMoved,
288
MouseButtonPressed,
289
MouseButtonReleased,
290
MouseMoved,
291
MouseEntered,
292
MouseLeft,
293
JoyButtonPressed,
294
JoyButtonReleased,
295
JoyMoved,
296
297
Count
// Keep last -- total number of event types
298
};
299
301
// Member data
303
EventType
Type
;
304
305
union
306
{
307
KeyEvent
Key;
308
TextEvent
Text;
309
MouseMoveEvent
MouseMove;
310
MouseButtonEvent
MouseButton;
311
MouseWheelEvent
MouseWheel;
312
JoyMoveEvent
JoyMove;
313
JoyButtonEvent
JoyButton;
314
SizeEvent
Size;
315
};
316
};
317
318
}
// namespace sf
319
320
321
#endif // SFML_EVENT_HPP