Skip to main content

Events System

The events/callbacks system.

Manually pumping events

caution

Manually pumping events would stop the virtual gamepads input from working properly.

To have them functioning again follow the last section in this page.

pullEvent

Pull an event.

Either pulled from the events stack if it has any events or the machine is suspended until an event is made.

eventName, a, b, c, d, e, f = pullEvent()
ReturnTypeNote
eventNamestring
aanyfirst parameter
banysecond parameter
canythird parameter
danyfourth parameter
eanyfifth parameter
fanysixth parameter

rawPullEvent

Pull a fresh new event bypassing the events queue.

event, a, b, c, d, e, f = rawPullEvent()
ReturnTypeNote
eventNamestring
aanyfirst parameter
banysecond parameter
canythird parameter
danyfourth parameter
eanyfifth parameter
fanysixth parameter

triggerEvent

Add a new event to the events stack.

triggerEvent(event, a, b, c, d, e, f)
ParameterTypeDefaultNote
eventNamestring⚠️ required
aanynilfirst parameter
banynilsecond parameter
canynilthird parameter
danynilfourth parameter
eanynilfifth parameter
fanynilsixth parameter

clearEStack

Clear the events stack.

clearEStack()

Supporting virtual GamePad input while manually pumping events

For GamePad input to still work properly the following functions has to be called in their corresponding events.

__BTNUpdate

To be called on every update event.

__BTNUpdate(deltaTime)
ParameterTypeDefaultNote
deltaTimenumber⚠️ requiredsince last call. in seconds.

__BTNKeypressed

To be called on every keypressed event.

__BTNKeypressed(keyName, isRepeat)
ParameterTypeDefaultNote
keyNamestring⚠️ required
isRepeatbooleanfalse

__BTNTouchControl

To be called on every touchcontrol event.

note

The touchcontrol event is an undocumented event that exists.

__BTNTouchControl(state, buttonId)
ParameterTypeDefaultNote
stateboolean⚠️ required
buttonIdnumber⚠️ required

__BTNGamepad

To be called on every gamepad event.

note

The gamepad event is an undocumented event that exists.

__BTNGamepad(state, buttonId, gamepadId)
ParameterTypeDefaultNote
stateboolean⚠️ required
buttonIdnumber⚠️ required
gamepadIdnumber⚠️ required