Irrlicht 3D Engine
 
Loading...
Searching...
No Matches
IEventReceiver.h
Go to the documentation of this file.
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{
72
128
131 {
135
138
141
142 EMBSM_FORCE_32_BIT = 0x7fffffff
143 };
144
145 namespace gui
146 {
147
148 class IGUIElement;
149
258 } // end namespace gui
259
260
262struct SEvent
263{
277
280 {
283
286
288
290
292 bool Shift:1;
293
295 bool Control:1;
296
301
303 bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }
304
306 bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }
307
309 bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }
310
313 };
314
317 {
319 wchar_t Char;
320
323
326
328 bool Shift:1;
329
331 bool Control:1;
332 };
333
335
343 {
344 enum
345 {
347
348 AXIS_X = 0, // e.g. analog stick 1 left to right
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
351 AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
355 };
356
360
370
377
379
382
384 bool IsButtonPressed(u32 button) const
385 {
386 if(button >= (u32)NUMBER_OF_BUTTONS)
387 return false;
388
389 return (ButtonStates & (1 << button)) ? true : false;
390 }
391 };
392
393
396 {
398 const c8* Text;
399
402 };
403
406 {
409
412 };
413
415 union
416 {
423 };
424
425};
426
428
434{
435public:
436
438 virtual ~IEventReceiver() {}
439
441
446 virtual bool OnEvent(const SEvent& event) = 0;
447};
448
449
452{
454
458
461
464
466
469
471
473 enum
474 {
477
480
484}; // struct SJoystickInfo
485
486
487} // end namespace irr
488
489#endif
490
Interface of an object which can receive events.
virtual ~IEventReceiver()
Destructor.
virtual bool OnEvent(const SEvent &event)=0
Called if an event happened.
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.h:22
Base class of all GUI elements.
Definition IGUIElement.h:26
EGUI_EVENT_TYPE
Enumeration for all events which are sendable by the gui system.
@ EGET_TREEVIEW_NODE_SELECT
A tree view node was selected. See IGUITreeView::getLastEventNode().
@ EGET_DIRECTORY_SELECTED
A directory has been selected in the file dialog.
@ EGET_CHECKBOX_CHANGED
A checkbox has changed its check state.
@ EGET_SCROLL_BAR_CHANGED
A scrollbar has changed its position.
@ EGET_BUTTON_CLICKED
A button was clicked.
@ EGET_TREEVIEW_NODE_EXPAND
A tree view node was expanded. See IGUITreeView::getLastEventNode().
@ EGET_EDITBOX_CHANGED
The text in an editbox was changed. This does not include automatic changes in text-breaking.
@ EGET_LISTBOX_SELECTED_AGAIN
An item in the listbox was selected, which was already selected.
@ EGET_COUNT
No real event. Just for convenience to get number of events.
@ EGET_MESSAGEBOX_NO
'No' was clicked on a messagebox
@ EGET_TABLE_CHANGED
A table has changed.
@ EGET_MESSAGEBOX_OK
'OK' was clicked on a messagebox
@ EGET_FILE_SELECTED
A file has been selected in the file dialog.
@ EGET_ELEMENT_HOVERED
The mouse cursor hovered over a gui element.
@ EGET_TAB_CHANGED
The tab was changed in an tab control.
@ EGET_MENU_ITEM_SELECTED
A menu item was selected in a (context) menu.
@ EGET_TREEVIEW_NODE_DESELECT
A tree view node lost selection. See IGUITreeView::getLastEventNode().
@ EGET_ELEMENT_CLOSED
An element would like to close.
@ EGET_SPINBOX_CHANGED
The value of a spin box has changed.
@ EGET_ELEMENT_FOCUSED
A gui element has got the focus.
@ EGET_TABLE_SELECTED_AGAIN
@ EGET_MESSAGEBOX_YES
'Yes' was clicked on a messagebox
@ EGET_ELEMENT_LEFT
The mouse cursor left the hovered element.
@ EGET_MESSAGEBOX_CANCEL
'Cancel' was clicked on a messagebox
@ EGET_LISTBOX_CHANGED
A new item in a listbox was selected.
@ EGET_EDITBOX_ENTER
In an editbox 'ENTER' was pressed.
@ EGET_TREEVIEW_NODE_COLLAPSE
A tree view node was collapsed. See IGUITreeView::getLastEventNode().
@ EGET_EDITBOX_MARKING_CHANGED
The marked area in an editbox was changed.
@ EGET_FILE_CHOOSE_DIALOG_CANCELLED
A file open dialog has been closed without choosing a file.
@ EGET_ELEMENT_FOCUS_LOST
A gui element has lost its focus.
@ EGET_TREEVIEW_NODE_COLLAPS
@ EGET_COMBO_BOX_CHANGED
The selection in a combo box has been changed.
@ EGET_TABLE_HEADER_CHANGED
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
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.
@ EMIE_LMOUSE_TRIPLE_CLICK
@ EMIE_MMOUSE_LEFT_UP
Middle mouse button was left up.
@ EMIE_LMOUSE_LEFT_UP
Left mouse button was left up.
@ EMIE_COUNT
No real event. Just for convenience to get number of events.
@ EMIE_MMOUSE_PRESSED_DOWN
Middle mouse button was pressed down.
@ EMIE_LMOUSE_PRESSED_DOWN
Left mouse button was pressed down.
@ EMIE_LMOUSE_DOUBLE_CLICK
@ EMIE_MMOUSE_TRIPLE_CLICK
@ EMIE_MMOUSE_DOUBLE_CLICK
@ EMIE_RMOUSE_DOUBLE_CLICK
@ EMIE_RMOUSE_TRIPLE_CLICK
@ EMIE_RMOUSE_PRESSED_DOWN
Right mouse button was pressed down.
@ EMIE_MOUSE_WHEEL
@ EMIE_RMOUSE_LEFT_UP
Right mouse button was left up.
@ EMIE_MOUSE_MOVED
The mouse cursor changed its position.
signed short s16
16 bit signed variable.
Definition irrTypes.h:48
EKEY_CODE
Definition Keycodes.h:12
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.h:18
E_MOUSE_BUTTON_STATE_MASK
Masks for mouse button states.
@ EMBSM_FORCE_32_BIT
@ EMBSM_RIGHT
@ EMBSM_EXTRA1
currently only on windows
@ EMBSM_EXTRA2
currently only on windows
@ EMBSM_MIDDLE
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.
@ EET_USER_EVENT
A user event with user data.
@ EET_KEY_INPUT_EVENT
A key input event.
@ EGUIET_FORCE_32_BIT
@ EET_LOG_TEXT_EVENT
A log event.
@ EET_MOUSE_INPUT_EVENT
A mouse input event.
@ EET_JOYSTICK_INPUT_EVENT
A joystick (joypad, gamepad) input event.
@ EET_GUI_EVENT
An event of the graphical user interface.
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.h:40
Any kind of GUI event.
gui::IGUIElement * Caller
IGUIElement who called the event.
gui::IGUIElement * Element
If the event has something to do with another element, it will be held here.
gui::EGUI_EVENT_TYPE EventType
Type of GUI Event.
u8 Joystick
The ID of the joystick which generated this event.
bool IsButtonPressed(u32 button) const
A helper function to check if a button is pressed.
Any kind of keyboard event.
wchar_t Char
Character corresponding to the key (0, if not a character)
bool Control
True if ctrl was also pressed.
bool Shift
True if shift was also pressed.
EKEY_CODE Key
Key which has been pressed or released.
bool PressedDown
If not true, then the key was left up.
Any kind of log event.
const c8 * Text
Pointer to text which has been logged.
ELOG_LEVEL Level
Log level in which the text has been logged.
Any kind of mouse event.
f32 Wheel
mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f;
bool isRightPressed() const
Is the right button pressed down?
s32 Y
Y position of mouse cursor.
bool Control
True if ctrl was also pressed.
bool isMiddlePressed() const
Is the middle button pressed down?
s32 X
X position of mouse cursor.
bool isLeftPressed() const
Is the left button pressed down?
EMOUSE_INPUT_EVENT Event
Type of mouse event.
bool Shift
True if shift was also pressed.
Any kind of user event.
s32 UserData2
Another user specified data as int.
s32 UserData1
Some user specified data as int.
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct SUserEvent UserEvent
struct SJoystickEvent JoystickEvent
struct SMouseInput MouseInput
EEVENT_TYPE EventType
struct SGUIEvent GUIEvent
struct SLogEvent LogEvent
struct SKeyInput KeyInput
Information on a joystick, returned from irr::IrrlichtDevice::activateJoysticks()
u32 Axes
The number of axes that the joystick has, i.e. X, Y, Z, R, U, V.
enum irr::SJoystickInfo::@3 PovHat
An indication of whether the joystick has a POV hat.
u32 Buttons
The number of buttons that the joystick has.
core::stringc Name
The name that the joystick uses to identify itself.
@ POV_HAT_UNKNOWN
The presence or absence of a hat cannot be determined.
@ POV_HAT_ABSENT
A hat is definitely not present.
@ POV_HAT_PRESENT
A hat is definitely present.
u8 Joystick
The ID of the joystick.