IrrCreateEventReceiver

section index

## NAME

IrrCreateEventReceiver - Create a Callback-EventReceiver

## SYNOPSIS

*eventreceiver.l = IrrCreateEventReceiver(*callbackfunction.l)

## INPUTS

*callbackfunction.l | - | a Pointer to the CallBack Function (@CallBack())

## FUNCTION

To enable the full functionality of irrlichts event-mechanism in PureBsic you can create a CallBack-EventReciver. To use this, you need to have a own Callback-Function (Procedure) and this function will be called for each event. Under the hood, the IrrlichtWrapper creates a EventReceiver-Class, that calls for each evant the Callback-Function. So you should be carefull and make no big calculations in that Callback-Function. You also need to set this EventReceiver as the current EventReceiver in Irrlicht with IrrSetEventReceiver().

## RESULT

Returns a Pointer to a EventReceiver.

## EXAMPLE

       ProcedureCDLL.l eventCallback(*event.SEvent)
           If *event\EventType = #IRR_EET_GUI_EVENT
               Debug("GUI-Event")
           ElseIf *event\EventType = #IRR_EET_MOUSE_INPUT_EVENT
               Debug("Mouse-Event")
           ElseIf *event\EventType = #EET_KEY_INPUT_EVENT
               Debug("Key-Event")
           ElseIf *event\EventType = #IRR_EET_LOG_TEXT_EVENT
               Debug("Log-Event")
           ElseIf *event\EventType = #IRR_EET_USER_EVENT
               Debug("User-Event")
           EndIf
       EndProcedure

       *eventRec.l = IrrCreateEventReceiver(@eventCallback())
       IrrSetEventReceiver(*eventRec)

## NOTES

The Example 30 (ImageGui) uses the Callback-EventReceiver.