Events

section index

## NAME

Read Irrlicht-Events

## DESCRIPTION

The IrrlichtEngine send some Events to a EventReceiver. These Evants are to determine Mouse-clicks or mouse movements. There are Events for Keys, for the GUI, and for the Logging. You can also create your own Events. In this Section you will find several functions to get informations about these Events. These Functiona are still from the original IrrlichtWrapper. But i'm not satisfied with this solution, while the techinique is slow and error-prone. So in the Background exists a Object that catches all Events from Irrlicht, and stores them in a Array. And the User have now to walk through all Events in the Arrays. The Problem is now, that you loose the sequence, and there are some events you have to react directly (e.g. in the GUI) !. But here is a small example how to use the 'old' solution :

## EXAMPLE

       ; while there are key events waiting to be processed
       While IrrKeyEventAvailable()

           ; read the key event out. the key event has three parameters the key
           ; scan code, the direction of the key and flags that indicate whether
           ; the control key or the shift keys were also pressed
           *KeyEvent.IRR_KEY_EVENT = IrrReadKeyEvent()

           ; arbitrate based on the key that was pressed
           Select *KeyEvent\key
           ; .. now check the Key and start the action ...
           EndSelect

       Wend
       ; same goes for mouse and GUI-Events !

## DESCRIPTION

So i created a 'better' Solution, and would recommend the new one. It's faster and more in the 'Irrlicht'-Style.

## EXAMPLE

       ;Callback-Procedure:
       ProcedureDLL eventCallback(*event.SEvent)
           ;Gui-Events
           If *event\EventType = #IRR_EET_GUI_EVENT
               id.l = IrrGuiGetId(*event\GuiEvent\Caller)
               Select *event\GuiEvent\EventType
                   Case #IRR_EGET_MENU_ITEM_SELECTED
                   Case #IRR_EGET_FILE_SELECTED:
                   Case #IRR_EGET_SCROLL_BAR_CHANGED:;
                   Case #IRR_EGET_COMBO_BOX_CHANGED:
                   Case #IRR_EGET_BUTTON_CLICKED:
               EndSelect
           EndIf

           ;Key-Events
           If *event\EventType = #IRR_EET_KEY_INPUT_EVENT
               key.l = *event\KeyEvent\Key
           EndIf

           If *event\EventType = #IRR_EET_MOUSE_INPUT_EVENT
               mouse_X.l = *event\MouseEvent\X
               mouse_Y.l = *event\MouseEvent\X
               mouse_wheel.f = *event\MouseEvent\Wheel
           EndIf
           ProcedureReturn #False
       EndProcedure

       ;Create the Event-Receiver, and set it as the active
       ;EventReceiver in Irrlicht.
       *ev.l = IrrCreateEventReceiver(@eventCallback)
       IrrSetEventReceiver(*ev)

     NOTE
       It is planned to remove these function from the Wrapper, since there is a much
       better Solution.

Contents=

- Events
- IrrGuiEventAvailable
- IrrKeyEventAvailable
- IrrMouseEventAvailable
- IrrReadGuiEvent
- IrrReadKeyEvent
- IrrReadMouseEvent