BRL.EventQueue: Globals Functions Modinfo Source  

Event queue

The event queue is a simple first-in, first-out queue that is used to collect event objects emitted by your application.

The PollEvent and WaitEvent commands can be used to receive the next event from the event queue, while the PeekEvent command can be used to check if the event queue is empty.

Events are added to the event queue using PostEvent.

Globals

Global CurrentEvent:TEvent
DescriptionCurrent Event.
InformationThe CurrentEvent global variable contains the event most recently returned by PollEvent or WaitEvent.

Functions

Function EventData()
ReturnsThe data field of the CurrentEvent global variable.
DescriptionGet current event data.

Function EventExtra:Object()
ReturnsThe extra field of the CurrentEvent global variable.
DescriptionGet current event extra value.

Function EventID()
ReturnsThe id field of the CurrentEvent global variable.
DescriptionGet current event id.

Function EventMods()
ReturnsThe mods field of the CurrentEvent global variable.
DescriptionGet current event modifiers.

Function EventSource:Object()
ReturnsThe source field of the CurrentEvent global variable.
DescriptionGet current event source object.

Function EventSourceHandle()
ReturnsThe source field of the CurrentEvent global variable converted to an integer handle.
DescriptionGet current event source object handle.

Function EventText$()
ReturnsThe extra field of the CurrentEvent global variable converted to a string.
DescriptionGet current event extra value converted to a string.

Function EventX()
ReturnsThe x field of the CurrentEvent global variable.
DescriptionGet current event x value.

Function EventY()
ReturnsThe y field of the CurrentEvent global variable.
DescriptionGet current event y value.

Function PeekEvent:TEvent()
DescriptionExamine the next event in the event queue.
InformationPeekEvent examines the next event in the event queue, without removing it from the event queue or modifying the CurrentEvent global variable.

If there are no events in the event queue, PeekEvent returns Null.

Function PollEvent()
ReturnsThe id of the next event in the event queue, or 0 if the event queue is empty.
DescriptionGet the next event from the event queue.
InformationPollEvent removes an event from the event queue and updates the CurrentEvent global variable.

If there are no events in the event queue, PollEvent returns Null.

Function PostEvent( event:TEvent,update=False )
DescriptionPost an event to the event queue.
InformationPostEvent adds an event to the end of the event queue.

The update flag can be used to update an existing event. If update is True and an event with the same id and source is found in the event queue, the existing event will be updated instead of event being added to the event queue. This can be useful to prevent high frequency events such as timer events from flooding the event queue.

Function WaitEvent()
ReturnsThe id of the next event in the event queue.
DescriptionGet the next event from the event queue, waiting if necessary.
InformationWaitEvent removes an event from the event queue and updates the CurrentEvent global variable.

If there are no events in the event queue, WaitEvent halts program execution until an event is available.

Module Information

Version1.00
AuthorMark Sibly
LicenseBlitz Shared Source Code
CopyrightBlitz Research Ltd
ModserverBRL
History1.00 Release
HistoryCreated module