v2026.5.3
All Bundles
Bundle SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

Event

SDL event

Operations

Flush # function

Clear events from the event queue

function : Flush(type:Int) ~ Nil

Parameters

NameTypeDescription
typeIntthe type of event to be cleared

Free #

Frees the event

method : public : Free() ~ Nil

GetJAxis #

Get joystick axis event

method : public : GetJAxis() ~ JoyAxisEvent

Return

TypeDescription
JoyAxisEventjoystick axis event

GetJButton #

Get joystick button event

method : public : GetJButton() ~ JoyButtonEvent

Return

TypeDescription
JoyButtonEventjoystick button event

GetJHat #

Get joystick hat event

method : public : GetJHat() ~ JoyHatEvent

Return

TypeDescription
JoyHatEventjoystick hat event

GetKey #

Get keyboard event

method : public : GetKey() ~ KeyboardEvent

Return

TypeDescription
KeyboardEventkeyboard event

GetMButton #

Get mouse button event

method : public : GetMButton() ~ MouseButtonEvent

Return

TypeDescription
MouseButtonEventmouse button event

GetMouseMotion #

Get mouse motion event

method : public : GetMouseMotion() ~ MouseMotionEvent

Return

TypeDescription
MouseMotionEventmouse motion event

GetMouseWheel #

Get mouse wheel event

method : public : GetMouseWheel() ~ MouseWheelEvent

Return

TypeDescription
MouseWheelEventmouse wheel event

GetTextInput #

Get text input event

method : public : GetTextInput() ~ TextInputEvent

Return

TypeDescription
TextInputEventtext input event

GetType #

Event type

method : public : GetType() ~ EventType

Return

TypeDescription
EventTypetype

Has # function

Check for the existence of certain event types in the event queue

function : Has(type:Int) ~ Bool

Parameters

NameTypeDescription
typeIntthe type of event to be queried

Return

TypeDescription
Booltrue if events matching type are present, false otherwise

IsNull #

Determines if the underlying SDL C-struct is NULL

method : public : IsNull() ~ Bool

Return

TypeDescription
Booltrue if NULL, false otherwise

New # constructor

Create a new event instance

New()

Peeps #

Check the event queue for messages and optionally return them

method : public : Peeps(numevents:Int, action:EventAction, minType:Int, maxType:Int) ~ Int

Parameters

NameTypeDescription
numeventsIntif action is SDL_ADDEVENT, the number of events to add back to the event queue; if action is SDL_PEEKEVENT or SDL_GETEVENT, the maximum number of events to retrieve
actionEventActionaction to take; see Remarks for details
minTypeIntminimum value of the event type to be considered; SDL_FIRSTEVENT is a safe choice
maxTypeIntmaximum value of the event type to be considered; SDL_LASTEVENT is a safe choice

Return

TypeDescription
Intnumber of events actually stored or a negative error code on failure

Poll #

Poll for currently pending events

method : public : Poll() ~ Int

Pump # function

Pump the event loop, gathering events from the input devices

function : Pump() ~ Nil

Push #

Add an event to the event queue

method : public : Push() ~ Int

Return

TypeDescription
Int1 on success, 0 if the event was filtered, or -1 if the event queue was full or there was some other error.

Registers # function

Allocate a set of user-defined events, and return the beginning event number for that set of events

function : Registers(numevents:Int) ~ Int

Parameters

NameTypeDescription
numeventsIntthe number of events to be allocated

State # function

Allows you to set the state of processing certain events.

function : State(type:Int, state:Int) ~ Int

Parameters

NameTypeDescription
typeIntthe type of event; see SDL_EventType for details
stateInthow to process the event; see Remarks for details

Return

TypeDescription
IntSDL_DISABLE or SDL_ENABLE, representing the processing state of the event before this function makes any changes to it

Wait #

Waits indefinitely for the next available event.

method : public : Wait() ~ Int

Return

TypeDescription
Int1, or 0 if there was an error while waiting for events

WaitTimeout #

Waits until the specified timeout (in milliseconds) for the next available event

method : public : WaitTimeout(timeout:Int) ~ Int

Parameters

NameTypeDescription
timeoutIntThe timeout (in milliseconds) to wait for next event

Return

TypeDescription
Int1, or 0 if there was an error while waiting for events