Skylicht Engine
Loading...
Searching...
No Matches
IEventReceiver.h
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_EVENT_RECEIVER_H_INCLUDED__
6#define __I_EVENT_RECEIVER_H_INCLUDED__
7
8#include "ILogger.h"
9#include "Keycodes.h"
10#include "irrString.h"
11
12namespace irr
13{
16 {
18
23
25
31
33
36
38
46 EET_GAMEPAD_INPUT_EVENT,
47
49
52
54
67
70
71 EET_GAME_EXIT,
72
73 EET_GAME_PAUSE,
74
75 EET_GAME_RESUME,
76
80
81 };
82
138
141 {
142 EMBSM_LEFT = 0x01,
143 EMBSM_RIGHT = 0x02,
144 EMBSM_MIDDLE = 0x04,
145
148
151
152 EMBSM_FORCE_32_BIT = 0x7fffffff
153 };
154
155 namespace gui
156 {
157
158 class IGUIElement;
159
268 } // end namespace gui
269
270
272struct SEvent
273{
276 {
278 gui::IGUIElement* Caller;
279
281 gui::IGUIElement* Element;
282
285
286 };
287
290 {
293
296
299
301
303
305 bool Shift:1;
306
308 bool Control:1;
309
314
316 bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }
317
319 bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }
320
322 bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }
323
326 };
327
330 {
332 wchar_t Char;
333
335 EKEY_CODE Key;
336
339
341 bool Shift:1;
342
344 bool Control:1;
345 };
346
348
356 {
357 enum
358 {
359 NUMBER_OF_BUTTONS = 32,
360
361 AXIS_X = 0, // e.g. analog stick 1 left to right
362 AXIS_Y, // e.g. analog stick 1 top to bottom
363 AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right
364 AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
365 AXIS_U,
366 AXIS_V,
367 NUMBER_OF_AXES
368 };
369
373
382 s16 Axis[NUMBER_OF_AXES];
383
390
392
395
397 bool IsButtonPressed(u32 button) const
398 {
399 if (button >= (u32)NUMBER_OF_BUTTONS)
400 return false;
401
402 return (ButtonStates & (1 << button)) ? true : false;
403 }
404 };
405
407 {
408 int GamepadKey;
409
410 bool IsAnalog;
411
412 f32 AnalogVecX[2];
413 f32 AnalogVecY[2];
414
415 bool PressedDown;
416
418
421 };
422
423
426 {
428 const c8* Text;
429
432 };
433
436 {
439
442 };
443
445 {
446 s32 EventID;
447 void* EventData;
448 void* Sender;
449 void* EventParams[5];
450 };
451
452 EEVENT_TYPE EventType;
453 union
454 {
455 struct SGUIEvent GUIEvent;
456 struct SMouseInput MouseInput;
457 struct SKeyInput KeyInput;
458 struct SJoystickEvent JoystickEvent;
459 struct SGamepadEvent GamepadEvent;
460 struct SLogEvent LogEvent;
461 struct SUserEvent UserEvent;
462 struct SGameEvent GameEvent;
463 };
464
465};
466
468
474{
475public:
476
478 virtual ~IEventReceiver() {}
479
481
486 virtual bool OnEvent(const SEvent& event) = 0;
487};
488
489
492{
494
498
501
504
506
509
511
513 enum
514 {
517
520
524}; // struct SJoystickInfo
525
526
527} // end namespace irr
528
529#endif
530
Interface of an object which can receive events.
Definition IEventReceiver.h:474
virtual ~IEventReceiver()
Destructor.
Definition IEventReceiver.h:478
virtual bool OnEvent(const SEvent &event)=0
Called if an event happened.
string< c8 > stringc
Typedef for character strings.
Definition irrString.h:1373
EGUI_EVENT_TYPE
Enumeration for all events which are sendable by the gui system.
Definition IEventReceiver.h:162
@ EGET_TREEVIEW_NODE_SELECT
A tree view node was selected. See IGUITreeView::getLastEventNode().
Definition IEventReceiver.h:253
@ EGET_DIRECTORY_SELECTED
A directory has been selected in the file dialog.
Definition IEventReceiver.h:206
@ EGET_CHECKBOX_CHANGED
A checkbox has changed its check state.
Definition IEventReceiver.h:192
@ EGET_SCROLL_BAR_CHANGED
A scrollbar has changed its position.
Definition IEventReceiver.h:189
@ EGET_BUTTON_CLICKED
A button was clicked.
Definition IEventReceiver.h:186
@ EGET_TREEVIEW_NODE_EXPAND
A tree view node was expanded. See IGUITreeView::getLastEventNode().
Definition IEventReceiver.h:256
@ EGET_EDITBOX_CHANGED
The text in an editbox was changed. This does not include automatic changes in text-breaking.
Definition IEventReceiver.h:227
@ EGET_LISTBOX_SELECTED_AGAIN
An item in the listbox was selected, which was already selected.
Definition IEventReceiver.h:200
@ EGET_COUNT
No real event. Just for convenience to get number of events.
Definition IEventReceiver.h:266
@ EGET_MESSAGEBOX_NO
'No' was clicked on a messagebox
Definition IEventReceiver.h:215
@ EGET_TABLE_CHANGED
A table has changed.
Definition IEventReceiver.h:245
@ EGET_MESSAGEBOX_OK
'OK' was clicked on a messagebox
Definition IEventReceiver.h:218
@ EGET_FILE_SELECTED
A file has been selected in the file dialog.
Definition IEventReceiver.h:203
@ EGET_ELEMENT_HOVERED
The mouse cursor hovered over a gui element.
Definition IEventReceiver.h:174
@ EGET_TAB_CHANGED
The tab was changed in an tab control.
Definition IEventReceiver.h:233
@ EGET_MENU_ITEM_SELECTED
A menu item was selected in a (context) menu.
Definition IEventReceiver.h:236
@ EGET_TREEVIEW_NODE_DESELECT
A tree view node lost selection. See IGUITreeView::getLastEventNode().
Definition IEventReceiver.h:250
@ EGET_ELEMENT_CLOSED
An element would like to close.
Definition IEventReceiver.h:183
@ EGET_SPINBOX_CHANGED
The value of a spin box has changed.
Definition IEventReceiver.h:242
@ EGET_ELEMENT_FOCUSED
A gui element has got the focus.
Definition IEventReceiver.h:170
@ EGET_MESSAGEBOX_YES
'Yes' was clicked on a messagebox
Definition IEventReceiver.h:212
@ EGET_ELEMENT_LEFT
The mouse cursor left the hovered element.
Definition IEventReceiver.h:178
@ EGET_MESSAGEBOX_CANCEL
'Cancel' was clicked on a messagebox
Definition IEventReceiver.h:221
@ EGET_LISTBOX_CHANGED
A new item in a listbox was selected.
Definition IEventReceiver.h:196
@ EGET_EDITBOX_ENTER
In an editbox 'ENTER' was pressed.
Definition IEventReceiver.h:224
@ EGET_TREEVIEW_NODE_COLLAPSE
A tree view node was collapsed. See IGUITreeView::getLastEventNode().
Definition IEventReceiver.h:259
@ EGET_EDITBOX_MARKING_CHANGED
The marked area in an editbox was changed.
Definition IEventReceiver.h:230
@ EGET_FILE_CHOOSE_DIALOG_CANCELLED
A file open dialog has been closed without choosing a file.
Definition IEventReceiver.h:209
@ EGET_ELEMENT_FOCUS_LOST
A gui element has lost its focus.
Definition IEventReceiver.h:166
@ EGET_TREEVIEW_NODE_COLLAPS
Definition IEventReceiver.h:263
@ EGET_COMBO_BOX_CHANGED
The selection in a combo box has been changed.
Definition IEventReceiver.h:239
Everything in the Irrlicht Engine can be found in this namespace.
Definition Skylicht.h:33
float f32
32 bit floating point variable.
Definition irrTypes.h:104
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
EMOUSE_INPUT_EVENT
Enumeration for all mouse input events.
Definition IEventReceiver.h:85
@ EMIE_LMOUSE_TRIPLE_CLICK
Definition IEventReceiver.h:125
@ EMIE_MMOUSE_LEFT_UP
Middle mouse button was left up.
Definition IEventReceiver.h:102
@ EMIE_LMOUSE_LEFT_UP
Left mouse button was left up.
Definition IEventReceiver.h:96
@ EMIE_COUNT
No real event. Just for convenience to get number of events.
Definition IEventReceiver.h:136
@ EMIE_MMOUSE_PRESSED_DOWN
Middle mouse button was pressed down.
Definition IEventReceiver.h:93
@ EMIE_LMOUSE_PRESSED_DOWN
Left mouse button was pressed down.
Definition IEventReceiver.h:87
@ EMIE_LMOUSE_DOUBLE_CLICK
Definition IEventReceiver.h:113
@ EMIE_MMOUSE_TRIPLE_CLICK
Definition IEventReceiver.h:133
@ EMIE_MMOUSE_DOUBLE_CLICK
Definition IEventReceiver.h:121
@ EMIE_RMOUSE_DOUBLE_CLICK
Definition IEventReceiver.h:117
@ EMIE_RMOUSE_TRIPLE_CLICK
Definition IEventReceiver.h:129
@ EMIE_RMOUSE_PRESSED_DOWN
Right mouse button was pressed down.
Definition IEventReceiver.h:90
@ EMIE_MOUSE_WHEEL
Definition IEventReceiver.h:109
@ EMIE_RMOUSE_LEFT_UP
Right mouse button was left up.
Definition IEventReceiver.h:99
@ EMIE_MOUSE_MOVED
The mouse cursor changed its position.
Definition IEventReceiver.h:105
signed short s16
16 bit signed variable.
Definition irrTypes.h:48
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.h:18
E_MOUSE_BUTTON_STATE_MASK
Masks for mouse button states.
Definition IEventReceiver.h:141
@ EMBSM_EXTRA1
currently only on windows
Definition IEventReceiver.h:147
@ EMBSM_EXTRA2
currently only on windows
Definition IEventReceiver.h:150
char c8
8 bit character variable.
Definition irrTypes.h:31
ELOG_LEVEL
Definition ILogger.h:18
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
EEVENT_TYPE
Enumeration for all event types there are.
Definition IEventReceiver.h:16
@ EET_USER_EVENT
A user event with user data.
Definition IEventReceiver.h:66
@ EET_KEY_INPUT_EVENT
A key input event.
Definition IEventReceiver.h:35
@ EGUIET_FORCE_32_BIT
Definition IEventReceiver.h:79
@ EET_LOG_TEXT_EVENT
A log event.
Definition IEventReceiver.h:51
@ EET_MOUSE_INPUT_EVENT
A mouse input event.
Definition IEventReceiver.h:30
@ EET_GAME_RESIZE
Skylicht framework event.
Definition IEventReceiver.h:69
@ EET_JOYSTICK_INPUT_EVENT
A joystick (joypad, gamepad) input event.
Definition IEventReceiver.h:45
@ EET_GUI_EVENT
An event of the graphical user interface.
Definition IEventReceiver.h:22
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.h:40
Any kind of GUI event.
Definition IEventReceiver.h:276
gui::IGUIElement * Caller
IGUIElement who called the event.
Definition IEventReceiver.h:278
gui::IGUIElement * Element
If the event has something to do with another element, it will be held here.
Definition IEventReceiver.h:281
gui::EGUI_EVENT_TYPE EventType
Type of GUI Event.
Definition IEventReceiver.h:284
Definition IEventReceiver.h:445
Definition IEventReceiver.h:407
u8 Gamepad
The ID of the joystick which generated this event.
Definition IEventReceiver.h:420
A joystick event.
Definition IEventReceiver.h:356
u8 Joystick
The ID of the joystick which generated this event.
Definition IEventReceiver.h:394
s16 Axis[NUMBER_OF_AXES]
Definition IEventReceiver.h:382
u32 ButtonStates
Definition IEventReceiver.h:372
bool IsButtonPressed(u32 button) const
A helper function to check if a button is pressed.
Definition IEventReceiver.h:397
u16 POV
Definition IEventReceiver.h:389
Any kind of keyboard event.
Definition IEventReceiver.h:330
wchar_t Char
Character corresponding to the key (0, if not a character).
Definition IEventReceiver.h:332
bool Control
True if ctrl was also pressed.
Definition IEventReceiver.h:344
bool Shift
True if shift was also pressed.
Definition IEventReceiver.h:341
EKEY_CODE Key
Key which has been pressed or released.
Definition IEventReceiver.h:335
bool PressedDown
If not true, then the key was left up.
Definition IEventReceiver.h:338
Any kind of log event.
Definition IEventReceiver.h:426
const c8 * Text
Pointer to text which has been logged.
Definition IEventReceiver.h:428
ELOG_LEVEL Level
Log level in which the text has been logged.
Definition IEventReceiver.h:431
Any kind of mouse event.
Definition IEventReceiver.h:290
f32 Wheel
mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f;
Definition IEventReceiver.h:302
bool isRightPressed() const
Is the right button pressed down?
Definition IEventReceiver.h:319
s32 Y
Y position of mouse cursor.
Definition IEventReceiver.h:295
bool Control
True if ctrl was also pressed.
Definition IEventReceiver.h:308
bool isMiddlePressed() const
Is the middle button pressed down?
Definition IEventReceiver.h:322
s32 X
X position of mouse cursor.
Definition IEventReceiver.h:292
bool isLeftPressed() const
Is the left button pressed down?
Definition IEventReceiver.h:316
s32 ID
ID of the touch.
Definition IEventReceiver.h:298
EMOUSE_INPUT_EVENT Event
Type of mouse event.
Definition IEventReceiver.h:325
u32 ButtonStates
Definition IEventReceiver.h:313
bool Shift
True if shift was also pressed.
Definition IEventReceiver.h:305
Any kind of user event.
Definition IEventReceiver.h:436
s32 UserData2
Another user specified data as int.
Definition IEventReceiver.h:441
s32 UserData1
Some user specified data as int.
Definition IEventReceiver.h:438
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
Definition IEventReceiver.h:273
Information on a joystick, returned from irr::IrrlichtDevice::activateJoysticks().
Definition IEventReceiver.h:492
u32 Axes
The number of axes that the joystick has, i.e. X, Y, Z, R, U, V.
Definition IEventReceiver.h:508
u32 Buttons
The number of buttons that the joystick has.
Definition IEventReceiver.h:503
@ POV_HAT_UNKNOWN
The presence or absence of a hat cannot be determined.
Definition IEventReceiver.h:522
@ POV_HAT_ABSENT
A hat is definitely not present.
Definition IEventReceiver.h:519
@ POV_HAT_PRESENT
A hat is definitely present.
Definition IEventReceiver.h:516
core::stringc Name
The name that the joystick uses to identify itself.
Definition IEventReceiver.h:500
u8 Joystick
The ID of the joystick.
Definition IEventReceiver.h:497
enum irr::SJoystickInfo::@062251134212323224321252336256333311247340176074 PovHat
An indication of whether the joystick has a POV hat.