aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/IEventReceiver.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/include/IEventReceiver.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/include/IEventReceiver.h')
-rw-r--r--libraries/irrlicht-1.8/include/IEventReceiver.h980
1 files changed, 490 insertions, 490 deletions
diff --git a/libraries/irrlicht-1.8/include/IEventReceiver.h b/libraries/irrlicht-1.8/include/IEventReceiver.h
index 419ded7..9c7813f 100644
--- a/libraries/irrlicht-1.8/include/IEventReceiver.h
+++ b/libraries/irrlicht-1.8/include/IEventReceiver.h
@@ -1,490 +1,490 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __I_EVENT_RECEIVER_H_INCLUDED__ 5#ifndef __I_EVENT_RECEIVER_H_INCLUDED__
6#define __I_EVENT_RECEIVER_H_INCLUDED__ 6#define __I_EVENT_RECEIVER_H_INCLUDED__
7 7
8#include "ILogger.h" 8#include "ILogger.h"
9#include "Keycodes.h" 9#include "Keycodes.h"
10#include "irrString.h" 10#include "irrString.h"
11 11
12namespace irr 12namespace irr
13{ 13{
14 //! Enumeration for all event types there are. 14 //! Enumeration for all event types there are.
15 enum EEVENT_TYPE 15 enum EEVENT_TYPE
16 { 16 {
17 //! An event of the graphical user interface. 17 //! An event of the graphical user interface.
18 /** GUI events are created by the GUI environment or the GUI elements in response 18 /** GUI events are created by the GUI environment or the GUI elements in response
19 to mouse or keyboard events. When a GUI element receives an event it will either 19 to mouse or keyboard events. When a GUI element receives an event it will either
20 process it and return true, or pass the event to its parent. If an event is not absorbed 20 process it and return true, or pass the event to its parent. If an event is not absorbed
21 before it reaches the root element then it will then be passed to the user receiver. */ 21 before it reaches the root element then it will then be passed to the user receiver. */
22 EET_GUI_EVENT = 0, 22 EET_GUI_EVENT = 0,
23 23
24 //! A mouse input event. 24 //! A mouse input event.
25 /** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser 25 /** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
26 in response to mouse input received from the operating system. 26 in response to mouse input received from the operating system.
27 Mouse events are first passed to the user receiver, then to the GUI environment and its elements, 27 Mouse events are first passed to the user receiver, then to the GUI environment and its elements,
28 then finally the input receiving scene manager where it is passed to the active camera. 28 then finally the input receiving scene manager where it is passed to the active camera.
29 */ 29 */
30 EET_MOUSE_INPUT_EVENT, 30 EET_MOUSE_INPUT_EVENT,
31 31
32 //! A key input event. 32 //! A key input event.
33 /** Like mouse events, keyboard events are created by the device and passed to 33 /** Like mouse events, keyboard events are created by the device and passed to
34 IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */ 34 IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
35 EET_KEY_INPUT_EVENT, 35 EET_KEY_INPUT_EVENT,
36 36
37 //! A joystick (joypad, gamepad) input event. 37 //! A joystick (joypad, gamepad) input event.
38 /** Joystick events are created by polling all connected joysticks once per 38 /** Joystick events are created by polling all connected joysticks once per
39 device run() and then passing the events to IrrlichtDevice::postEventFromUser. 39 device run() and then passing the events to IrrlichtDevice::postEventFromUser.
40 They take the same path as mouse events. 40 They take the same path as mouse events.
41 Windows, SDL: Implemented. 41 Windows, SDL: Implemented.
42 Linux: Implemented, with POV hat issues. 42 Linux: Implemented, with POV hat issues.
43 MacOS / Other: Not yet implemented. 43 MacOS / Other: Not yet implemented.
44 */ 44 */
45 EET_JOYSTICK_INPUT_EVENT, 45 EET_JOYSTICK_INPUT_EVENT,
46 46
47 //! A log event 47 //! A log event
48 /** Log events are only passed to the user receiver if there is one. If they are absorbed by the 48 /** Log events are only passed to the user receiver if there is one. If they are absorbed by the
49 user receiver then no text will be sent to the console. */ 49 user receiver then no text will be sent to the console. */
50 EET_LOG_TEXT_EVENT, 50 EET_LOG_TEXT_EVENT,
51 51
52 //! A user event with user data. 52 //! A user event with user data.
53 /** This is not used by Irrlicht and can be used to send user 53 /** This is not used by Irrlicht and can be used to send user
54 specific data though the system. The Irrlicht 'window handle' 54 specific data though the system. The Irrlicht 'window handle'
55 can be obtained from IrrlichtDevice::getExposedVideoData() 55 can be obtained from IrrlichtDevice::getExposedVideoData()
56 The usage and behavior depends on the operating system: 56 The usage and behavior depends on the operating system:
57 Windows: send a WM_USER message to the Irrlicht Window; the 57 Windows: send a WM_USER message to the Irrlicht Window; the
58 wParam and lParam will be used to populate the 58 wParam and lParam will be used to populate the
59 UserData1 and UserData2 members of the SUserEvent. 59 UserData1 and UserData2 members of the SUserEvent.
60 Linux: send a ClientMessage via XSendEvent to the Irrlicht 60 Linux: send a ClientMessage via XSendEvent to the Irrlicht
61 Window; the data.l[0] and data.l[1] members will be 61 Window; the data.l[0] and data.l[1] members will be
62 casted to s32 and used as UserData1 and UserData2. 62 casted to s32 and used as UserData1 and UserData2.
63 MacOS: Not yet implemented 63 MacOS: Not yet implemented
64 */ 64 */
65 EET_USER_EVENT, 65 EET_USER_EVENT,
66 66
67 //! This enum is never used, it only forces the compiler to 67 //! This enum is never used, it only forces the compiler to
68 //! compile these enumeration values to 32 bit. 68 //! compile these enumeration values to 32 bit.
69 EGUIET_FORCE_32_BIT = 0x7fffffff 69 EGUIET_FORCE_32_BIT = 0x7fffffff
70 70
71 }; 71 };
72 72
73 //! Enumeration for all mouse input events 73 //! Enumeration for all mouse input events
74 enum EMOUSE_INPUT_EVENT 74 enum EMOUSE_INPUT_EVENT
75 { 75 {
76 //! Left mouse button was pressed down. 76 //! Left mouse button was pressed down.
77 EMIE_LMOUSE_PRESSED_DOWN = 0, 77 EMIE_LMOUSE_PRESSED_DOWN = 0,
78 78
79 //! Right mouse button was pressed down. 79 //! Right mouse button was pressed down.
80 EMIE_RMOUSE_PRESSED_DOWN, 80 EMIE_RMOUSE_PRESSED_DOWN,
81 81
82 //! Middle mouse button was pressed down. 82 //! Middle mouse button was pressed down.
83 EMIE_MMOUSE_PRESSED_DOWN, 83 EMIE_MMOUSE_PRESSED_DOWN,
84 84
85 //! Left mouse button was left up. 85 //! Left mouse button was left up.
86 EMIE_LMOUSE_LEFT_UP, 86 EMIE_LMOUSE_LEFT_UP,
87 87
88 //! Right mouse button was left up. 88 //! Right mouse button was left up.
89 EMIE_RMOUSE_LEFT_UP, 89 EMIE_RMOUSE_LEFT_UP,
90 90
91 //! Middle mouse button was left up. 91 //! Middle mouse button was left up.
92 EMIE_MMOUSE_LEFT_UP, 92 EMIE_MMOUSE_LEFT_UP,
93 93
94 //! The mouse cursor changed its position. 94 //! The mouse cursor changed its position.
95 EMIE_MOUSE_MOVED, 95 EMIE_MOUSE_MOVED,
96 96
97 //! The mouse wheel was moved. Use Wheel value in event data to find out 97 //! The mouse wheel was moved. Use Wheel value in event data to find out
98 //! in what direction and how fast. 98 //! in what direction and how fast.
99 EMIE_MOUSE_WHEEL, 99 EMIE_MOUSE_WHEEL,
100 100
101 //! Left mouse button double click. 101 //! Left mouse button double click.
102 //! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event. 102 //! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event.
103 EMIE_LMOUSE_DOUBLE_CLICK, 103 EMIE_LMOUSE_DOUBLE_CLICK,
104 104
105 //! Right mouse button double click. 105 //! Right mouse button double click.
106 //! This event is generated after the second EMIE_RMOUSE_PRESSED_DOWN event. 106 //! This event is generated after the second EMIE_RMOUSE_PRESSED_DOWN event.
107 EMIE_RMOUSE_DOUBLE_CLICK, 107 EMIE_RMOUSE_DOUBLE_CLICK,
108 108
109 //! Middle mouse button double click. 109 //! Middle mouse button double click.
110 //! This event is generated after the second EMIE_MMOUSE_PRESSED_DOWN event. 110 //! This event is generated after the second EMIE_MMOUSE_PRESSED_DOWN event.
111 EMIE_MMOUSE_DOUBLE_CLICK, 111 EMIE_MMOUSE_DOUBLE_CLICK,
112 112
113 //! Left mouse button triple click. 113 //! Left mouse button triple click.
114 //! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event. 114 //! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event.
115 EMIE_LMOUSE_TRIPLE_CLICK, 115 EMIE_LMOUSE_TRIPLE_CLICK,
116 116
117 //! Right mouse button triple click. 117 //! Right mouse button triple click.
118 //! This event is generated after the third EMIE_RMOUSE_PRESSED_DOWN event. 118 //! This event is generated after the third EMIE_RMOUSE_PRESSED_DOWN event.
119 EMIE_RMOUSE_TRIPLE_CLICK, 119 EMIE_RMOUSE_TRIPLE_CLICK,
120 120
121 //! Middle mouse button triple click. 121 //! Middle mouse button triple click.
122 //! This event is generated after the third EMIE_MMOUSE_PRESSED_DOWN event. 122 //! This event is generated after the third EMIE_MMOUSE_PRESSED_DOWN event.
123 EMIE_MMOUSE_TRIPLE_CLICK, 123 EMIE_MMOUSE_TRIPLE_CLICK,
124 124
125 //! No real event. Just for convenience to get number of events 125 //! No real event. Just for convenience to get number of events
126 EMIE_COUNT 126 EMIE_COUNT
127 }; 127 };
128 128
129 //! Masks for mouse button states 129 //! Masks for mouse button states
130 enum E_MOUSE_BUTTON_STATE_MASK 130 enum E_MOUSE_BUTTON_STATE_MASK
131 { 131 {
132 EMBSM_LEFT = 0x01, 132 EMBSM_LEFT = 0x01,
133 EMBSM_RIGHT = 0x02, 133 EMBSM_RIGHT = 0x02,
134 EMBSM_MIDDLE = 0x04, 134 EMBSM_MIDDLE = 0x04,
135 135
136 //! currently only on windows 136 //! currently only on windows
137 EMBSM_EXTRA1 = 0x08, 137 EMBSM_EXTRA1 = 0x08,
138 138
139 //! currently only on windows 139 //! currently only on windows
140 EMBSM_EXTRA2 = 0x10, 140 EMBSM_EXTRA2 = 0x10,
141 141
142 EMBSM_FORCE_32_BIT = 0x7fffffff 142 EMBSM_FORCE_32_BIT = 0x7fffffff
143 }; 143 };
144 144
145 namespace gui 145 namespace gui
146 { 146 {
147 147
148 class IGUIElement; 148 class IGUIElement;
149 149
150 //! Enumeration for all events which are sendable by the gui system 150 //! Enumeration for all events which are sendable by the gui system
151 enum EGUI_EVENT_TYPE 151 enum EGUI_EVENT_TYPE
152 { 152 {
153 //! A gui element has lost its focus. 153 //! A gui element has lost its focus.
154 /** GUIEvent.Caller is losing the focus to GUIEvent.Element. 154 /** GUIEvent.Caller is losing the focus to GUIEvent.Element.
155 If the event is absorbed then the focus will not be changed. */ 155 If the event is absorbed then the focus will not be changed. */
156 EGET_ELEMENT_FOCUS_LOST = 0, 156 EGET_ELEMENT_FOCUS_LOST = 0,
157 157
158 //! A gui element has got the focus. 158 //! A gui element has got the focus.
159 /** If the event is absorbed then the focus will not be changed. */ 159 /** If the event is absorbed then the focus will not be changed. */
160 EGET_ELEMENT_FOCUSED, 160 EGET_ELEMENT_FOCUSED,
161 161
162 //! The mouse cursor hovered over a gui element. 162 //! The mouse cursor hovered over a gui element.
163 /** If an element has sub-elements you also get this message for the subelements */ 163 /** If an element has sub-elements you also get this message for the subelements */
164 EGET_ELEMENT_HOVERED, 164 EGET_ELEMENT_HOVERED,
165 165
166 //! The mouse cursor left the hovered element. 166 //! The mouse cursor left the hovered element.
167 /** If an element has sub-elements you also get this message for the subelements */ 167 /** If an element has sub-elements you also get this message for the subelements */
168 EGET_ELEMENT_LEFT, 168 EGET_ELEMENT_LEFT,
169 169
170 //! An element would like to close. 170 //! An element would like to close.
171 /** Windows and context menus use this event when they would like to close, 171 /** Windows and context menus use this event when they would like to close,
172 this can be cancelled by absorbing the event. */ 172 this can be cancelled by absorbing the event. */
173 EGET_ELEMENT_CLOSED, 173 EGET_ELEMENT_CLOSED,
174 174
175 //! A button was clicked. 175 //! A button was clicked.
176 EGET_BUTTON_CLICKED, 176 EGET_BUTTON_CLICKED,
177 177
178 //! A scrollbar has changed its position. 178 //! A scrollbar has changed its position.
179 EGET_SCROLL_BAR_CHANGED, 179 EGET_SCROLL_BAR_CHANGED,
180 180
181 //! A checkbox has changed its check state. 181 //! A checkbox has changed its check state.
182 EGET_CHECKBOX_CHANGED, 182 EGET_CHECKBOX_CHANGED,
183 183
184 //! A new item in a listbox was selected. 184 //! A new item in a listbox was selected.
185 /** NOTE: You also get this event currently when the same item was clicked again after more than 500 ms. */ 185 /** NOTE: You also get this event currently when the same item was clicked again after more than 500 ms. */
186 EGET_LISTBOX_CHANGED, 186 EGET_LISTBOX_CHANGED,
187 187
188 //! An item in the listbox was selected, which was already selected. 188 //! An item in the listbox was selected, which was already selected.
189 /** NOTE: You get the event currently only if the item was clicked again within 500 ms or selected by "enter" or "space". */ 189 /** NOTE: You get the event currently only if the item was clicked again within 500 ms or selected by "enter" or "space". */
190 EGET_LISTBOX_SELECTED_AGAIN, 190 EGET_LISTBOX_SELECTED_AGAIN,
191 191
192 //! A file has been selected in the file dialog 192 //! A file has been selected in the file dialog
193 EGET_FILE_SELECTED, 193 EGET_FILE_SELECTED,
194 194
195 //! A directory has been selected in the file dialog 195 //! A directory has been selected in the file dialog
196 EGET_DIRECTORY_SELECTED, 196 EGET_DIRECTORY_SELECTED,
197 197
198 //! A file open dialog has been closed without choosing a file 198 //! A file open dialog has been closed without choosing a file
199 EGET_FILE_CHOOSE_DIALOG_CANCELLED, 199 EGET_FILE_CHOOSE_DIALOG_CANCELLED,
200 200
201 //! 'Yes' was clicked on a messagebox 201 //! 'Yes' was clicked on a messagebox
202 EGET_MESSAGEBOX_YES, 202 EGET_MESSAGEBOX_YES,
203 203
204 //! 'No' was clicked on a messagebox 204 //! 'No' was clicked on a messagebox
205 EGET_MESSAGEBOX_NO, 205 EGET_MESSAGEBOX_NO,
206 206
207 //! 'OK' was clicked on a messagebox 207 //! 'OK' was clicked on a messagebox
208 EGET_MESSAGEBOX_OK, 208 EGET_MESSAGEBOX_OK,
209 209
210 //! 'Cancel' was clicked on a messagebox 210 //! 'Cancel' was clicked on a messagebox
211 EGET_MESSAGEBOX_CANCEL, 211 EGET_MESSAGEBOX_CANCEL,
212 212
213 //! In an editbox 'ENTER' was pressed 213 //! In an editbox 'ENTER' was pressed
214 EGET_EDITBOX_ENTER, 214 EGET_EDITBOX_ENTER,
215 215
216 //! The text in an editbox was changed. This does not include automatic changes in text-breaking. 216 //! The text in an editbox was changed. This does not include automatic changes in text-breaking.
217 EGET_EDITBOX_CHANGED, 217 EGET_EDITBOX_CHANGED,
218 218
219 //! The marked area in an editbox was changed. 219 //! The marked area in an editbox was changed.
220 EGET_EDITBOX_MARKING_CHANGED, 220 EGET_EDITBOX_MARKING_CHANGED,
221 221
222 //! The tab was changed in an tab control 222 //! The tab was changed in an tab control
223 EGET_TAB_CHANGED, 223 EGET_TAB_CHANGED,
224 224
225 //! A menu item was selected in a (context) menu 225 //! A menu item was selected in a (context) menu
226 EGET_MENU_ITEM_SELECTED, 226 EGET_MENU_ITEM_SELECTED,
227 227
228 //! The selection in a combo box has been changed 228 //! The selection in a combo box has been changed
229 EGET_COMBO_BOX_CHANGED, 229 EGET_COMBO_BOX_CHANGED,
230 230
231 //! The value of a spin box has changed 231 //! The value of a spin box has changed
232 EGET_SPINBOX_CHANGED, 232 EGET_SPINBOX_CHANGED,
233 233
234 //! A table has changed 234 //! A table has changed
235 EGET_TABLE_CHANGED, 235 EGET_TABLE_CHANGED,
236 EGET_TABLE_HEADER_CHANGED, 236 EGET_TABLE_HEADER_CHANGED,
237 EGET_TABLE_SELECTED_AGAIN, 237 EGET_TABLE_SELECTED_AGAIN,
238 238
239 //! A tree view node lost selection. See IGUITreeView::getLastEventNode(). 239 //! A tree view node lost selection. See IGUITreeView::getLastEventNode().
240 EGET_TREEVIEW_NODE_DESELECT, 240 EGET_TREEVIEW_NODE_DESELECT,
241 241
242 //! A tree view node was selected. See IGUITreeView::getLastEventNode(). 242 //! A tree view node was selected. See IGUITreeView::getLastEventNode().
243 EGET_TREEVIEW_NODE_SELECT, 243 EGET_TREEVIEW_NODE_SELECT,
244 244
245 //! A tree view node was expanded. See IGUITreeView::getLastEventNode(). 245 //! A tree view node was expanded. See IGUITreeView::getLastEventNode().
246 EGET_TREEVIEW_NODE_EXPAND, 246 EGET_TREEVIEW_NODE_EXPAND,
247 247
248 //! A tree view node was collapsed. See IGUITreeView::getLastEventNode(). 248 //! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
249 EGET_TREEVIEW_NODE_COLLAPSE, 249 EGET_TREEVIEW_NODE_COLLAPSE,
250 250
251 //! deprecated - use EGET_TREEVIEW_NODE_COLLAPSE instead. This 251 //! deprecated - use EGET_TREEVIEW_NODE_COLLAPSE instead. This
252 //! may be removed by Irrlicht 1.9 252 //! may be removed by Irrlicht 1.9
253 EGET_TREEVIEW_NODE_COLLAPS = EGET_TREEVIEW_NODE_COLLAPSE, 253 EGET_TREEVIEW_NODE_COLLAPS = EGET_TREEVIEW_NODE_COLLAPSE,
254 254
255 //! No real event. Just for convenience to get number of events 255 //! No real event. Just for convenience to get number of events
256 EGET_COUNT 256 EGET_COUNT
257 }; 257 };
258 } // end namespace gui 258 } // end namespace gui
259 259
260 260
261//! SEvents hold information about an event. See irr::IEventReceiver for details on event handling. 261//! SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
262struct SEvent 262struct SEvent
263{ 263{
264 //! Any kind of GUI event. 264 //! Any kind of GUI event.
265 struct SGUIEvent 265 struct SGUIEvent
266 { 266 {
267 //! IGUIElement who called the event 267 //! IGUIElement who called the event
268 gui::IGUIElement* Caller; 268 gui::IGUIElement* Caller;
269 269
270 //! If the event has something to do with another element, it will be held here. 270 //! If the event has something to do with another element, it will be held here.
271 gui::IGUIElement* Element; 271 gui::IGUIElement* Element;
272 272
273 //! Type of GUI Event 273 //! Type of GUI Event
274 gui::EGUI_EVENT_TYPE EventType; 274 gui::EGUI_EVENT_TYPE EventType;
275 275
276 }; 276 };
277 277
278 //! Any kind of mouse event. 278 //! Any kind of mouse event.
279 struct SMouseInput 279 struct SMouseInput
280 { 280 {
281 //! X position of mouse cursor 281 //! X position of mouse cursor
282 s32 X; 282 s32 X;
283 283
284 //! Y position of mouse cursor 284 //! Y position of mouse cursor
285 s32 Y; 285 s32 Y;
286 286
287 //! mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f; 287 //! mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f;
288 /** Only valid if event was EMIE_MOUSE_WHEEL */ 288 /** Only valid if event was EMIE_MOUSE_WHEEL */
289 f32 Wheel; 289 f32 Wheel;
290 290
291 //! True if shift was also pressed 291 //! True if shift was also pressed
292 bool Shift:1; 292 bool Shift:1;
293 293
294 //! True if ctrl was also pressed 294 //! True if ctrl was also pressed
295 bool Control:1; 295 bool Control:1;
296 296
297 //! A bitmap of button states. You can use isButtonPressed() to determine 297 //! A bitmap of button states. You can use isButtonPressed() to determine
298 //! if a button is pressed or not. 298 //! if a button is pressed or not.
299 //! Currently only valid if the event was EMIE_MOUSE_MOVED 299 //! Currently only valid if the event was EMIE_MOUSE_MOVED
300 u32 ButtonStates; 300 u32 ButtonStates;
301 301
302 //! Is the left button pressed down? 302 //! Is the left button pressed down?
303 bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); } 303 bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }
304 304
305 //! Is the right button pressed down? 305 //! Is the right button pressed down?
306 bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); } 306 bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }
307 307
308 //! Is the middle button pressed down? 308 //! Is the middle button pressed down?
309 bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); } 309 bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }
310 310
311 //! Type of mouse event 311 //! Type of mouse event
312 EMOUSE_INPUT_EVENT Event; 312 EMOUSE_INPUT_EVENT Event;
313 }; 313 };
314 314
315 //! Any kind of keyboard event. 315 //! Any kind of keyboard event.
316 struct SKeyInput 316 struct SKeyInput
317 { 317 {
318 //! Character corresponding to the key (0, if not a character) 318 //! Character corresponding to the key (0, if not a character)
319 wchar_t Char; 319 wchar_t Char;
320 320
321 //! Key which has been pressed or released 321 //! Key which has been pressed or released
322 EKEY_CODE Key; 322 EKEY_CODE Key;
323 323
324 //! If not true, then the key was left up 324 //! If not true, then the key was left up
325 bool PressedDown:1; 325 bool PressedDown:1;
326 326
327 //! True if shift was also pressed 327 //! True if shift was also pressed
328 bool Shift:1; 328 bool Shift:1;
329 329
330 //! True if ctrl was also pressed 330 //! True if ctrl was also pressed
331 bool Control:1; 331 bool Control:1;
332 }; 332 };
333 333
334 //! A joystick event. 334 //! A joystick event.
335 /** Unlike other events, joystick events represent the result of polling 335 /** Unlike other events, joystick events represent the result of polling
336 * each connected joystick once per run() of the device. Joystick events will 336 * each connected joystick once per run() of the device. Joystick events will
337 * not be generated by default. If joystick support is available for the 337 * not be generated by default. If joystick support is available for the
338 * active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and 338 * active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
339 * @ref irr::IrrlichtDevice::activateJoysticks() has been called, an event of 339 * @ref irr::IrrlichtDevice::activateJoysticks() has been called, an event of
340 * this type will be generated once per joystick per @ref IrrlichtDevice::run() 340 * this type will be generated once per joystick per @ref IrrlichtDevice::run()
341 * regardless of whether the state of the joystick has actually changed. */ 341 * regardless of whether the state of the joystick has actually changed. */
342 struct SJoystickEvent 342 struct SJoystickEvent
343 { 343 {
344 enum 344 enum
345 { 345 {
346 NUMBER_OF_BUTTONS = 32, 346 NUMBER_OF_BUTTONS = 32,
347 347
348 AXIS_X = 0, // e.g. analog stick 1 left to right 348 AXIS_X = 0, // e.g. analog stick 1 left to right
349 AXIS_Y, // e.g. analog stick 1 top to bottom 349 AXIS_Y, // e.g. analog stick 1 top to bottom
350 AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right 350 AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right
351 AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom 351 AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
352 AXIS_U, 352 AXIS_U,
353 AXIS_V, 353 AXIS_V,
354 NUMBER_OF_AXES 354 NUMBER_OF_AXES
355 }; 355 };
356 356
357 /** A bitmap of button states. You can use IsButtonPressed() to 357 /** A bitmap of button states. You can use IsButtonPressed() to
358 ( check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1) */ 358 ( check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1) */
359 u32 ButtonStates; 359 u32 ButtonStates;
360 360
361 /** For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V 361 /** For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V
362 * Values are in the range -32768 to 32767, with 0 representing 362 * Values are in the range -32768 to 32767, with 0 representing
363 * the center position. You will receive the raw value from the 363 * the center position. You will receive the raw value from the
364 * joystick, and so will usually want to implement a dead zone around 364 * joystick, and so will usually want to implement a dead zone around
365 * the center of the range. Axes not supported by this joystick will 365 * the center of the range. Axes not supported by this joystick will
366 * always have a value of 0. On Linux, POV hats are represented as axes, 366 * always have a value of 0. On Linux, POV hats are represented as axes,
367 * usually the last two active axis. 367 * usually the last two active axis.
368 */ 368 */
369 s16 Axis[NUMBER_OF_AXES]; 369 s16 Axis[NUMBER_OF_AXES];
370 370
371 /** The POV represents the angle of the POV hat in degrees * 100, 371 /** The POV represents the angle of the POV hat in degrees * 100,
372 * from 0 to 35,900. A value of 65535 indicates that the POV hat 372 * from 0 to 35,900. A value of 65535 indicates that the POV hat
373 * is centered (or not present). 373 * is centered (or not present).
374 * This value is only supported on Windows. On Linux, the POV hat 374 * This value is only supported on Windows. On Linux, the POV hat
375 * will be sent as 2 axes instead. */ 375 * will be sent as 2 axes instead. */
376 u16 POV; 376 u16 POV;
377 377
378 //! The ID of the joystick which generated this event. 378 //! The ID of the joystick which generated this event.
379 /** This is an internal Irrlicht index; it does not map directly 379 /** This is an internal Irrlicht index; it does not map directly
380 * to any particular hardware joystick. */ 380 * to any particular hardware joystick. */
381 u8 Joystick; 381 u8 Joystick;
382 382
383 //! A helper function to check if a button is pressed. 383 //! A helper function to check if a button is pressed.
384 bool IsButtonPressed(u32 button) const 384 bool IsButtonPressed(u32 button) const
385 { 385 {
386 if(button >= (u32)NUMBER_OF_BUTTONS) 386 if(button >= (u32)NUMBER_OF_BUTTONS)
387 return false; 387 return false;
388 388
389 return (ButtonStates & (1 << button)) ? true : false; 389 return (ButtonStates & (1 << button)) ? true : false;
390 } 390 }
391 }; 391 };
392 392
393 393
394 //! Any kind of log event. 394 //! Any kind of log event.
395 struct SLogEvent 395 struct SLogEvent
396 { 396 {
397 //! Pointer to text which has been logged 397 //! Pointer to text which has been logged
398 const c8* Text; 398 const c8* Text;
399 399
400 //! Log level in which the text has been logged 400 //! Log level in which the text has been logged
401 ELOG_LEVEL Level; 401 ELOG_LEVEL Level;
402 }; 402 };
403 403
404 //! Any kind of user event. 404 //! Any kind of user event.
405 struct SUserEvent 405 struct SUserEvent
406 { 406 {
407 //! Some user specified data as int 407 //! Some user specified data as int
408 s32 UserData1; 408 s32 UserData1;
409 409
410 //! Another user specified data as int 410 //! Another user specified data as int
411 s32 UserData2; 411 s32 UserData2;
412 }; 412 };
413 413
414 EEVENT_TYPE EventType; 414 EEVENT_TYPE EventType;
415 union 415 union
416 { 416 {
417 struct SGUIEvent GUIEvent; 417 struct SGUIEvent GUIEvent;
418 struct SMouseInput MouseInput; 418 struct SMouseInput MouseInput;
419 struct SKeyInput KeyInput; 419 struct SKeyInput KeyInput;
420 struct SJoystickEvent JoystickEvent; 420 struct SJoystickEvent JoystickEvent;
421 struct SLogEvent LogEvent; 421 struct SLogEvent LogEvent;
422 struct SUserEvent UserEvent; 422 struct SUserEvent UserEvent;
423 }; 423 };
424 424
425}; 425};
426 426
427//! Interface of an object which can receive events. 427//! Interface of an object which can receive events.
428/** Many of the engine's classes inherit IEventReceiver so they are able to 428/** Many of the engine's classes inherit IEventReceiver so they are able to
429process events. Events usually start at a postEventFromUser function and are 429process events. Events usually start at a postEventFromUser function and are
430passed down through a chain of event receivers until OnEvent returns true. See 430passed down through a chain of event receivers until OnEvent returns true. See
431irr::EEVENT_TYPE for a description of where each type of event starts, and the 431irr::EEVENT_TYPE for a description of where each type of event starts, and the
432path it takes through the system. */ 432path it takes through the system. */
433class IEventReceiver 433class IEventReceiver
434{ 434{
435public: 435public:
436 436
437 //! Destructor 437 //! Destructor
438 virtual ~IEventReceiver() {} 438 virtual ~IEventReceiver() {}
439 439
440 //! Called if an event happened. 440 //! Called if an event happened.
441 /** Please take care that you should only return 'true' when you want to _prevent_ Irrlicht 441 /** Please take care that you should only return 'true' when you want to _prevent_ Irrlicht
442 * from processing the event any further. So 'true' does mean that an event is completely done. 442 * from processing the event any further. So 'true' does mean that an event is completely done.
443 * Therefore your return value for all unprocessed events should be 'false'. 443 * Therefore your return value for all unprocessed events should be 'false'.
444 \return True if the event was processed. 444 \return True if the event was processed.
445 */ 445 */
446 virtual bool OnEvent(const SEvent& event) = 0; 446 virtual bool OnEvent(const SEvent& event) = 0;
447}; 447};
448 448
449 449
450//! Information on a joystick, returned from @ref irr::IrrlichtDevice::activateJoysticks() 450//! Information on a joystick, returned from @ref irr::IrrlichtDevice::activateJoysticks()
451struct SJoystickInfo 451struct SJoystickInfo
452{ 452{
453 //! The ID of the joystick 453 //! The ID of the joystick
454 /** This is an internal Irrlicht index; it does not map directly 454 /** This is an internal Irrlicht index; it does not map directly
455 * to any particular hardware joystick. It corresponds to the 455 * to any particular hardware joystick. It corresponds to the
456 * irr::SJoystickEvent Joystick ID. */ 456 * irr::SJoystickEvent Joystick ID. */
457 u8 Joystick; 457 u8 Joystick;
458 458
459 //! The name that the joystick uses to identify itself. 459 //! The name that the joystick uses to identify itself.
460 core::stringc Name; 460 core::stringc Name;
461 461
462 //! The number of buttons that the joystick has. 462 //! The number of buttons that the joystick has.
463 u32 Buttons; 463 u32 Buttons;
464 464
465 //! The number of axes that the joystick has, i.e. X, Y, Z, R, U, V. 465 //! The number of axes that the joystick has, i.e. X, Y, Z, R, U, V.
466 /** Note: with a Linux device, the POV hat (if any) will use two axes. These 466 /** Note: with a Linux device, the POV hat (if any) will use two axes. These
467 * will be included in this count. */ 467 * will be included in this count. */
468 u32 Axes; 468 u32 Axes;
469 469
470 //! An indication of whether the joystick has a POV hat. 470 //! An indication of whether the joystick has a POV hat.
471 /** A Windows device will identify the presence or absence or the POV hat. A 471 /** A Windows device will identify the presence or absence or the POV hat. A
472 * Linux device cannot, and will always return POV_HAT_UNKNOWN. */ 472 * Linux device cannot, and will always return POV_HAT_UNKNOWN. */
473 enum 473 enum
474 { 474 {
475 //! A hat is definitely present. 475 //! A hat is definitely present.
476 POV_HAT_PRESENT, 476 POV_HAT_PRESENT,
477 477
478 //! A hat is definitely not present. 478 //! A hat is definitely not present.
479 POV_HAT_ABSENT, 479 POV_HAT_ABSENT,
480 480
481 //! The presence or absence of a hat cannot be determined. 481 //! The presence or absence of a hat cannot be determined.
482 POV_HAT_UNKNOWN 482 POV_HAT_UNKNOWN
483 } PovHat; 483 } PovHat;
484}; // struct SJoystickInfo 484}; // struct SJoystickInfo
485 485
486 486
487} // end namespace irr 487} // end namespace irr
488 488
489#endif 489#endif
490 490