]> git.lizzy.rs Git - irrlicht.git/blob - include/IEventReceiver.h
Add github workflow & gitignore
[irrlicht.git] / include / IEventReceiver.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __I_EVENT_RECEIVER_H_INCLUDED__\r
6 #define __I_EVENT_RECEIVER_H_INCLUDED__\r
7 \r
8 #include "ILogger.h"\r
9 #include "Keycodes.h"\r
10 #include "irrString.h"\r
11 \r
12 namespace irr\r
13 {\r
14         //! Enumeration for all event types there are.\r
15         enum EEVENT_TYPE\r
16         {\r
17                 //! An event of the graphical user interface.\r
18                 /** GUI events are created by the GUI environment or the GUI elements in response\r
19                 to mouse or keyboard events. When a GUI element receives an event it will either\r
20                 process it and return true, or pass the event to its parent. If an event is not absorbed\r
21                 before it reaches the root element then it will then be passed to the user receiver. */\r
22                 EET_GUI_EVENT = 0,\r
23 \r
24                 //! A mouse input event.\r
25                 /** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser\r
26                 in response to mouse input received from the operating system.\r
27                 Mouse events are first passed to the user receiver, then to the GUI environment and its elements,\r
28                 then finally the input receiving scene manager where it is passed to the active camera.\r
29                 */\r
30                 EET_MOUSE_INPUT_EVENT,\r
31 \r
32                 //! A key input event.\r
33                 /** Like mouse events, keyboard events are created by the device and passed to\r
34                 IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */\r
35                 EET_KEY_INPUT_EVENT,\r
36 \r
37         //! A touch input event.\r
38                 EET_TOUCH_INPUT_EVENT,\r
39 \r
40                 //! A accelerometer event.\r
41                 EET_ACCELEROMETER_EVENT,\r
42 \r
43                 //! A gyroscope event.\r
44                 EET_GYROSCOPE_EVENT,\r
45 \r
46                 //! A device motion event.\r
47                 EET_DEVICE_MOTION_EVENT,\r
48 \r
49                 //! A joystick (joypad, gamepad) input event.\r
50                 /** Joystick events are created by polling all connected joysticks once per\r
51                 device run() and then passing the events to IrrlichtDevice::postEventFromUser.\r
52                 They take the same path as mouse events.\r
53                 Windows, SDL: Implemented.\r
54                 Linux: Implemented, with POV hat issues.\r
55                 MacOS / Other: Not yet implemented.\r
56                 */\r
57                 EET_JOYSTICK_INPUT_EVENT,\r
58 \r
59                 //! A log event\r
60                 /** Log events are only passed to the user receiver if there is one. If they are absorbed by the\r
61                 user receiver then no text will be sent to the console. */\r
62                 EET_LOG_TEXT_EVENT,\r
63 \r
64                 //! A user event with user data.\r
65                 /** This is not used by Irrlicht and can be used to send user\r
66                 specific data though the system. The Irrlicht 'window handle'\r
67                 can be obtained from IrrlichtDevice::getExposedVideoData()\r
68                 The usage and behavior depends on the operating system:\r
69                 Windows: send a WM_USER message to the Irrlicht Window; the\r
70                         wParam and lParam will be used to populate the\r
71                         UserData1 and UserData2 members of the SUserEvent.\r
72                 Linux: send a ClientMessage via XSendEvent to the Irrlicht\r
73                         Window; the data.l[0] and data.l[1] members will be\r
74                         cast to s32 and used as UserData1 and UserData2.\r
75                 MacOS: Not yet implemented\r
76                 */\r
77                 EET_USER_EVENT,\r
78 \r
79                 //! Pass on raw events from the OS\r
80                 EET_SYSTEM_EVENT,\r
81 \r
82                 //! Application state events like a resume, pause etc.\r
83                 EET_APPLICATION_EVENT,\r
84 \r
85                 //! This enum is never used, it only forces the compiler to\r
86                 //! compile these enumeration values to 32 bit.\r
87                 EGUIET_FORCE_32_BIT = 0x7fffffff\r
88 \r
89         };\r
90 \r
91         //! Enumeration for all mouse input events\r
92         enum EMOUSE_INPUT_EVENT\r
93         {\r
94                 //! Left mouse button was pressed down.\r
95                 EMIE_LMOUSE_PRESSED_DOWN = 0,\r
96 \r
97                 //! Right mouse button was pressed down.\r
98                 EMIE_RMOUSE_PRESSED_DOWN,\r
99 \r
100                 //! Middle mouse button was pressed down.\r
101                 EMIE_MMOUSE_PRESSED_DOWN,\r
102 \r
103                 //! Left mouse button was left up.\r
104                 EMIE_LMOUSE_LEFT_UP,\r
105 \r
106                 //! Right mouse button was left up.\r
107                 EMIE_RMOUSE_LEFT_UP,\r
108 \r
109                 //! Middle mouse button was left up.\r
110                 EMIE_MMOUSE_LEFT_UP,\r
111 \r
112                 //! The mouse cursor changed its position.\r
113                 EMIE_MOUSE_MOVED,\r
114 \r
115                 //! The mouse wheel was moved. Use Wheel value in event data to find out\r
116                 //! in what direction and how fast.\r
117                 EMIE_MOUSE_WHEEL,\r
118 \r
119                 //! Left mouse button double click.\r
120                 //! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event.\r
121                 EMIE_LMOUSE_DOUBLE_CLICK,\r
122 \r
123                 //! Right mouse button double click.\r
124                 //! This event is generated after the second EMIE_RMOUSE_PRESSED_DOWN event.\r
125                 EMIE_RMOUSE_DOUBLE_CLICK,\r
126 \r
127                 //! Middle mouse button double click.\r
128                 //! This event is generated after the second EMIE_MMOUSE_PRESSED_DOWN event.\r
129                 EMIE_MMOUSE_DOUBLE_CLICK,\r
130 \r
131                 //! Left mouse button triple click.\r
132                 //! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event.\r
133                 EMIE_LMOUSE_TRIPLE_CLICK,\r
134 \r
135                 //! Right mouse button triple click.\r
136                 //! This event is generated after the third EMIE_RMOUSE_PRESSED_DOWN event.\r
137                 EMIE_RMOUSE_TRIPLE_CLICK,\r
138 \r
139                 //! Middle mouse button triple click.\r
140                 //! This event is generated after the third EMIE_MMOUSE_PRESSED_DOWN event.\r
141                 EMIE_MMOUSE_TRIPLE_CLICK,\r
142 \r
143                 //! Mouse enters canvas used for rendering.\r
144                 //! Only generated on emscripten\r
145                 EMIE_MOUSE_ENTER_CANVAS,\r
146 \r
147                 //! Mouse leaves canvas used for rendering.\r
148                 //! Only generated on emscripten\r
149                 EMIE_MOUSE_LEAVE_CANVAS,\r
150 \r
151                 //! No real event. Just for convenience to get number of events\r
152                 EMIE_COUNT\r
153         };\r
154 \r
155         //! Masks for mouse button states\r
156         enum E_MOUSE_BUTTON_STATE_MASK\r
157         {\r
158                 EMBSM_LEFT    = 0x01,\r
159                 EMBSM_RIGHT   = 0x02,\r
160                 EMBSM_MIDDLE  = 0x04,\r
161 \r
162                 //! currently only on windows\r
163                 EMBSM_EXTRA1  = 0x08,\r
164 \r
165                 //! currently only on windows\r
166                 EMBSM_EXTRA2  = 0x10,\r
167 \r
168                 EMBSM_FORCE_32_BIT = 0x7fffffff\r
169         };\r
170 \r
171     //! Enumeration for all touch input events\r
172         enum ETOUCH_INPUT_EVENT\r
173         {\r
174                 //! Touch was pressed down.\r
175                 ETIE_PRESSED_DOWN = 0,\r
176 \r
177                 //! Touch was left up.\r
178                 ETIE_LEFT_UP,\r
179 \r
180                 //! The touch changed its position.\r
181                 ETIE_MOVED,\r
182 \r
183                 //! No real event. Just for convenience to get number of events\r
184                 ETIE_COUNT\r
185         };\r
186 \r
187         enum ESYSTEM_EVENT_TYPE\r
188         {\r
189                 //! From Android command handler for native activity messages\r
190                 ESET_ANDROID_CMD = 0,\r
191 \r
192                 // TODO: for example ESET_WINDOWS_MESSAGE for win32 message loop events\r
193 \r
194                 //! No real event, but to get number of event types\r
195                 ESET_COUNT\r
196         };\r
197 \r
198         //! Enumeration for a commonly used application state events (it's useful mainly for mobile devices)\r
199         enum EAPPLICATION_EVENT_TYPE\r
200         {\r
201                 //! The application will be resumed.\r
202                 EAET_WILL_RESUME = 0,\r
203 \r
204                 //! The application has been resumed.\r
205                 EAET_DID_RESUME,\r
206 \r
207                 //! The application will be paused.\r
208                 EAET_WILL_PAUSE,\r
209 \r
210                 //! The application has been paused.\r
211                 EAET_DID_PAUSE,\r
212 \r
213                 //! The application will be terminated.\r
214                 EAET_WILL_TERMINATE,\r
215 \r
216                 //! The application received a memory warning.\r
217                 EAET_MEMORY_WARNING,\r
218 \r
219                 //! No real event, but to get number of event types.\r
220                 EAET_COUNT\r
221         };\r
222 \r
223         namespace gui\r
224         {\r
225 \r
226                 class IGUIElement;\r
227 \r
228                 //! Enumeration for all events which are sendable by the gui system\r
229                 enum EGUI_EVENT_TYPE\r
230                 {\r
231                         //! A gui element has lost its focus.\r
232                         /** GUIEvent.Caller is losing the focus to GUIEvent.Element.\r
233                         If the event is absorbed then the focus will not be changed. */\r
234                         EGET_ELEMENT_FOCUS_LOST = 0,\r
235 \r
236                         //! A gui element has got the focus.\r
237                         /** If the event is absorbed then the focus will not be changed. */\r
238                         EGET_ELEMENT_FOCUSED,\r
239 \r
240                         //! The mouse cursor hovered over a gui element.\r
241                         /** If an element has sub-elements you also get this message for the subelements */\r
242                         EGET_ELEMENT_HOVERED,\r
243 \r
244                         //! The mouse cursor left the hovered element.\r
245                         /** If an element has sub-elements you also get this message for the subelements */\r
246                         EGET_ELEMENT_LEFT,\r
247 \r
248                         //! An element would like to close.\r
249                         /** Windows and context menus use this event when they would like to close,\r
250                         this can be canceled by absorbing the event. */\r
251                         EGET_ELEMENT_CLOSED,\r
252 \r
253                         //! A button was clicked.\r
254                         EGET_BUTTON_CLICKED,\r
255 \r
256                         //! A scrollbar has changed its position.\r
257                         EGET_SCROLL_BAR_CHANGED,\r
258 \r
259                         //! A checkbox has changed its check state.\r
260                         EGET_CHECKBOX_CHANGED,\r
261 \r
262                         //! A new item in a listbox was selected.\r
263                         /** NOTE: You also get this event currently when the same item was clicked again after more than 500 ms. */\r
264                         EGET_LISTBOX_CHANGED,\r
265 \r
266                         //! An item in the listbox was selected, which was already selected.\r
267                         /** NOTE: You get the event currently only if the item was clicked again within 500 ms or selected by "enter" or "space". */\r
268                         EGET_LISTBOX_SELECTED_AGAIN,\r
269 \r
270                         //! A file has been selected in the file dialog\r
271                         EGET_FILE_SELECTED,\r
272 \r
273                         //! A directory has been selected in the file dialog\r
274                         EGET_DIRECTORY_SELECTED,\r
275 \r
276                         //! A file open dialog has been closed without choosing a file\r
277                         EGET_FILE_CHOOSE_DIALOG_CANCELLED,\r
278 \r
279                         //! 'Yes' was clicked on a messagebox\r
280                         EGET_MESSAGEBOX_YES,\r
281 \r
282                         //! 'No' was clicked on a messagebox\r
283                         EGET_MESSAGEBOX_NO,\r
284 \r
285                         //! 'OK' was clicked on a messagebox\r
286                         EGET_MESSAGEBOX_OK,\r
287 \r
288                         //! 'Cancel' was clicked on a messagebox\r
289                         EGET_MESSAGEBOX_CANCEL,\r
290 \r
291                         //! In an editbox 'ENTER' was pressed\r
292                         EGET_EDITBOX_ENTER,\r
293 \r
294                         //! The text in an editbox was changed. This does not include automatic changes in text-breaking.\r
295                         EGET_EDITBOX_CHANGED,\r
296 \r
297                         //! The marked area in an editbox was changed.\r
298                         EGET_EDITBOX_MARKING_CHANGED,\r
299 \r
300                         //! The tab was changed in an tab control\r
301                         EGET_TAB_CHANGED,\r
302 \r
303                         //! A menu item was selected in a (context) menu\r
304                         EGET_MENU_ITEM_SELECTED,\r
305 \r
306                         //! The selection in a combo box has been changed\r
307                         EGET_COMBO_BOX_CHANGED,\r
308 \r
309                         //! The value of a spin box has changed\r
310                         EGET_SPINBOX_CHANGED,\r
311 \r
312                         //! A table has changed\r
313                         EGET_TABLE_CHANGED,\r
314                         EGET_TABLE_HEADER_CHANGED,\r
315                         EGET_TABLE_SELECTED_AGAIN,\r
316 \r
317                         //! A tree view node lost selection. See IGUITreeView::getLastEventNode().\r
318                         EGET_TREEVIEW_NODE_DESELECT,\r
319 \r
320                         //! A tree view node was selected. See IGUITreeView::getLastEventNode().\r
321                         EGET_TREEVIEW_NODE_SELECT,\r
322 \r
323                         //! A tree view node was expanded. See IGUITreeView::getLastEventNode().\r
324                         EGET_TREEVIEW_NODE_EXPAND,\r
325 \r
326                         //! A tree view node was collapsed. See IGUITreeView::getLastEventNode().\r
327                         EGET_TREEVIEW_NODE_COLLAPSE,\r
328 \r
329                         //! deprecated - use EGET_TREEVIEW_NODE_COLLAPSE instead. This\r
330                         //! may be removed by Irrlicht 1.9\r
331                         EGET_TREEVIEW_NODE_COLLAPS = EGET_TREEVIEW_NODE_COLLAPSE,\r
332 \r
333                         //! No real event. Just for convenience to get number of events\r
334                         EGET_COUNT\r
335                 };\r
336         } // end namespace gui\r
337 \r
338 \r
339 //! SEvents hold information about an event. See irr::IEventReceiver for details on event handling.\r
340 struct SEvent\r
341 {\r
342         //! Any kind of GUI event.\r
343         struct SGUIEvent\r
344         {\r
345                 //! IGUIElement who called the event\r
346                 gui::IGUIElement* Caller;\r
347 \r
348                 //! If the event has something to do with another element, it will be held here.\r
349                 gui::IGUIElement* Element;\r
350 \r
351                 //! Type of GUI Event\r
352                 gui::EGUI_EVENT_TYPE EventType;\r
353 \r
354         };\r
355 \r
356         //! Any kind of mouse event.\r
357         struct SMouseInput\r
358         {\r
359                 //! X position of mouse cursor\r
360                 s32 X;\r
361 \r
362                 //! Y position of mouse cursor\r
363                 s32 Y;\r
364 \r
365                 //! mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f;\r
366                 /** Only valid if event was EMIE_MOUSE_WHEEL */\r
367                 f32 Wheel;\r
368 \r
369                 //! True if shift was also pressed\r
370                 bool Shift:1;\r
371 \r
372                 //! True if ctrl was also pressed\r
373                 bool Control:1;\r
374 \r
375                 //! A bitmap of button states. You can use isButtonPressed() to determine\r
376                 //! if a button is pressed or not.\r
377                 //! Currently only valid if the event was EMIE_MOUSE_MOVED\r
378                 u32 ButtonStates;\r
379 \r
380                 //! Is the left button pressed down?\r
381                 bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }\r
382 \r
383                 //! Is the right button pressed down?\r
384                 bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }\r
385 \r
386                 //! Is the middle button pressed down?\r
387                 bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }\r
388 \r
389                 //! Type of mouse event\r
390                 EMOUSE_INPUT_EVENT Event;\r
391         };\r
392 \r
393         //! Any kind of keyboard event.\r
394         struct SKeyInput\r
395         {\r
396                 //! Character corresponding to the key (0, if not a character, value undefined in key releases)\r
397                 wchar_t Char;\r
398 \r
399                 //! Key which has been pressed or released\r
400                 EKEY_CODE Key;\r
401 \r
402                 //! System dependent code. Only set for systems which are described below, otherwise undefined.\r
403                 //! Android: int32_t with physical key as returned by AKeyEvent_getKeyCode\r
404                 u32 SystemKeyCode;\r
405 \r
406                 //! If not true, then the key was left up\r
407                 bool PressedDown:1;\r
408 \r
409                 //! True if shift was also pressed\r
410                 bool Shift:1;\r
411 \r
412                 //! True if ctrl was also pressed\r
413                 bool Control:1;\r
414         };\r
415 \r
416     //! Any kind of touch event.\r
417         struct STouchInput\r
418         {\r
419                 // Touch ID.\r
420                 size_t ID;\r
421 \r
422                 // X position of simple touch.\r
423                 s32 X;\r
424 \r
425                 // Y position of simple touch.\r
426                 s32 Y;\r
427 \r
428                 //! Type of touch event.\r
429                 ETOUCH_INPUT_EVENT Event;\r
430         };\r
431 \r
432         //! Any kind of accelerometer event.\r
433         struct SAccelerometerEvent\r
434         {\r
435                 // X acceleration.\r
436                 f64 X;\r
437 \r
438                 // Y acceleration.\r
439                 f64 Y;\r
440 \r
441                 // Z acceleration.\r
442                 f64 Z;\r
443         };\r
444 \r
445     //! Any kind of gyroscope event.\r
446         struct SGyroscopeEvent\r
447         {\r
448                 // X rotation.\r
449                 f64 X;\r
450 \r
451                 // Y rotation.\r
452                 f64 Y;\r
453 \r
454                 // Z rotation.\r
455                 f64 Z;\r
456         };\r
457 \r
458         //! Any kind of device motion event.\r
459         struct SDeviceMotionEvent\r
460         {\r
461                 // X angle - roll.\r
462                 f64 X;\r
463 \r
464                 // Y angle - pitch.\r
465                 f64 Y;\r
466 \r
467                 // Z angle - yaw.\r
468                 f64 Z;\r
469         };\r
470 \r
471         //! A joystick event.\r
472         /** Unlike other events, joystick events represent the result of polling\r
473          * each connected joystick once per run() of the device. Joystick events will\r
474          * not be generated by default.  If joystick support is available for the\r
475          * active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and\r
476          * @ref irr::IrrlichtDevice::activateJoysticks() has been called, an event of\r
477          * this type will be generated once per joystick per @ref IrrlichtDevice::run()\r
478          * regardless of whether the state of the joystick has actually changed. */\r
479         struct SJoystickEvent\r
480         {\r
481                 enum\r
482                 {\r
483                         NUMBER_OF_BUTTONS = 32,\r
484 \r
485                         AXIS_X = 0,     // e.g. analog stick 1 left to right\r
486                         AXIS_Y,         // e.g. analog stick 1 top to bottom\r
487                         AXIS_Z,         // e.g. throttle, or analog 2 stick 2 left to right\r
488                         AXIS_R,         // e.g. rudder, or analog 2 stick 2 top to bottom\r
489                         AXIS_U,\r
490                         AXIS_V,\r
491                         NUMBER_OF_AXES=18       // (please tell Irrlicht maintainers if you absolutely need more axes)\r
492                 };\r
493 \r
494                 /** A bitmap of button states.  You can use IsButtonPressed() to\r
495                  ( check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1) */\r
496                 u32 ButtonStates;\r
497 \r
498                 /** For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V\r
499                  * Values are in the range -32768 to 32767, with 0 representing\r
500                  * the center position.  You will receive the raw value from the\r
501                  * joystick, and so will usually want to implement a dead zone around\r
502                  * the center of the range. Axes not supported by this joystick will\r
503                  * always have a value of 0. On Linux, POV hats are represented as axes,\r
504                  * usually the last two active axis.\r
505                  */\r
506                 s16 Axis[NUMBER_OF_AXES];\r
507 \r
508                 /** The POV represents the angle of the POV hat in degrees * 100,\r
509                  * from 0 to 35,900.  A value of 65535 indicates that the POV hat\r
510                  * is centered (or not present).\r
511                  * This value is only supported on Windows.  On Linux, the POV hat\r
512                  * will be sent as 2 axes instead. */\r
513                 u16 POV;\r
514 \r
515                 //! The ID of the joystick which generated this event.\r
516                 /** This is an internal Irrlicht index; it does not map directly\r
517                  * to any particular hardware joystick. */\r
518                 u8 Joystick;\r
519 \r
520                 //! A helper function to check if a button is pressed.\r
521                 bool IsButtonPressed(u32 button) const\r
522                 {\r
523                         if(button >= (u32)NUMBER_OF_BUTTONS)\r
524                                 return false;\r
525 \r
526                         return (ButtonStates & (1 << button)) ? true : false;\r
527                 }\r
528         };\r
529 \r
530         //! Any kind of log event.\r
531         struct SLogEvent\r
532         {\r
533                 //! Pointer to text which has been logged\r
534                 const c8* Text;\r
535 \r
536                 //! Log level in which the text has been logged\r
537                 ELOG_LEVEL Level;\r
538         };\r
539 \r
540         //! Any kind of user event.\r
541         struct SUserEvent\r
542         {\r
543                 //! Some user specified data as int\r
544                 size_t UserData1;\r
545 \r
546                 //! Another user specified data as int\r
547                 size_t UserData2;\r
548         };\r
549 \r
550         // Raw events from the OS\r
551         struct SSystemEvent\r
552         {\r
553                 //! Android command handler native activity messages.\r
554                 struct SAndroidCmd\r
555                 {\r
556                         //!  APP_CMD_ enums defined in android_native_app_glue.h from the Android NDK\r
557                         s32 Cmd;\r
558                 };\r
559 \r
560                 // TOOD: more structs for iphone, Windows, X11, etc.\r
561 \r
562                 ESYSTEM_EVENT_TYPE EventType;\r
563                 union\r
564                 {\r
565                         struct SAndroidCmd AndroidCmd;\r
566                 };\r
567         };\r
568 \r
569         // Application state event\r
570         struct SApplicationEvent\r
571         {\r
572                 EAPPLICATION_EVENT_TYPE EventType;\r
573         };\r
574 \r
575         EEVENT_TYPE EventType;\r
576         union\r
577         {\r
578                 struct SGUIEvent GUIEvent;\r
579                 struct SMouseInput MouseInput;\r
580                 struct SKeyInput KeyInput;\r
581                 struct STouchInput TouchInput;\r
582                 struct SAccelerometerEvent AccelerometerEvent;\r
583                 struct SGyroscopeEvent GyroscopeEvent;\r
584                 struct SDeviceMotionEvent DeviceMotionEvent;\r
585                 struct SJoystickEvent JoystickEvent;\r
586                 struct SLogEvent LogEvent;\r
587                 struct SUserEvent UserEvent;\r
588                 struct SSystemEvent SystemEvent;\r
589                 struct SApplicationEvent ApplicationEvent;\r
590         };\r
591 \r
592 };\r
593 \r
594 //! Interface of an object which can receive events.\r
595 /** Many of the engine's classes inherit IEventReceiver so they are able to\r
596 process events. Events usually start at a postEventFromUser function and are\r
597 passed down through a chain of event receivers until OnEvent returns true. See\r
598 irr::EEVENT_TYPE for a description of where each type of event starts, and the\r
599 path it takes through the system. */\r
600 class IEventReceiver\r
601 {\r
602 public:\r
603 \r
604         //! Destructor\r
605         virtual ~IEventReceiver() {}\r
606 \r
607         //! Called if an event happened.\r
608         /** Please take care that you should only return 'true' when you want to _prevent_ Irrlicht\r
609         * from processing the event any further. So 'true' does mean that an event is completely done.\r
610         * Therefore your return value for all unprocessed events should be 'false'.\r
611         \return True if the event was processed.\r
612         */\r
613         virtual bool OnEvent(const SEvent& event) = 0;\r
614 };\r
615 \r
616 \r
617 //! Information on a joystick, returned from @ref irr::IrrlichtDevice::activateJoysticks()\r
618 struct SJoystickInfo\r
619 {\r
620         //! The ID of the joystick\r
621         /** This is an internal Irrlicht index; it does not map directly\r
622          * to any particular hardware joystick. It corresponds to the\r
623          * irr::SJoystickEvent Joystick ID. */\r
624         u8 Joystick;\r
625 \r
626         //! The name that the joystick uses to identify itself.\r
627         core::stringc Name;\r
628 \r
629         //! The number of buttons that the joystick has.\r
630         u32 Buttons;\r
631 \r
632         //! The number of axes that the joystick has, i.e. X, Y, Z, R, U, V.\r
633         /** Note: with a Linux device, the POV hat (if any) will use two axes. These\r
634          *  will be included in this count. */\r
635         u32 Axes;\r
636 \r
637         //! An indication of whether the joystick has a POV hat.\r
638         /** A Windows device will identify the presence or absence of the POV hat.\r
639          *  A Linux device cannot, and will always return POV_HAT_UNKNOWN. */\r
640         enum\r
641         {\r
642                 //! A hat is definitely present.\r
643                 POV_HAT_PRESENT,\r
644 \r
645                 //! A hat is definitely not present.\r
646                 POV_HAT_ABSENT,\r
647 \r
648                 //! The presence or absence of a hat cannot be determined.\r
649                 POV_HAT_UNKNOWN\r
650         } PovHat;\r
651 }; // struct SJoystickInfo\r
652 \r
653 \r
654 } // end namespace irr\r
655 \r
656 #endif\r
657 \r