On this page
  1. tecs.platform.events
  2. Borrowed records
  3. Synthetic and replayed input
  4. Module contents
    1. Types
    2. Functions
    3. Values
  5. Types
    1. Event
    2. KindTypes
  6. Functions
    1. copy
    2. kinds
    3. push
    4. source
    5. typeOf
  7. Values
    1. on

tecs.platform.events

One typed platform event stream.

Every platform delivers the same vocabulary through the world's event bus. Each kind has one ECS event type at address zero:

world:observe(
    0,
    tecs.platform.events.on.dropFile,
    function(event: tecs.platform.events.Event) loadFile(event.text) end
)

local pending <const>: {tecs.platform.events.Event} = {}
world:observe(
    0,
    tecs.platform.events.on.keyDown,
    function(event: tecs.platform.events.Event)
        pending[#pending + 1] = tecs.platform.events.copy(event)
    end
)

The application drains platform events before world:update. Observers run outside every phase and fixed step. The application updates input state before it emits an event, so an observer sees the new state.

SDL converts SIGINT and SIGTERM into events.on.quit, so an application uses the same normal shutdown path for a terminal interrupt and a window close. A headless program without an application uses tecs.platform.os.newSignalListener and drives tecs.runtime.poll itself.

Borrowed records

The converter reuses one wide Event record. kind determines which payload fields carry meaning. Read the record during the observer call, or retain an independent value through events.copy.

Mouse and converted touch positions use logical window coordinates. timestamp uses the platform event clock. arrival uses the monotonic seconds returned by tecs.platform.time.now, which makes it suitable for input-latency measurement.

Unrecognized platform events arrive as unknown with their numeric type. Finger and touch-device identities remain opaque strings.

Synthetic and replayed input

Tests can push an engine event through the host queue:

tecs.platform.events.push(
    "mouseDown",
    {
        button = 1,
        x = 120,
        y = 64,
    }
)

Install events.source to replace the host queue during replay. Pair it with tecs.platform.time.provider to replay event order and frame deltas together. Set the source to nil to resume the host queue.

Module contents

Types

Type Kind Description
Event record Represents a borrowed platform event routed through the ECS event bus.
KindTypes record Maps each event kind to an ECS event type observed at address zero.

Functions

Function Kind Description
copy Static Returns an independent copy, for code that must retain an event past the handler that received it.
kinds Static Returns every kind this build recognizes.
push Static Pushes a synthetic event onto SDL's own queue.
source Static Caller-writable. Installs a replay driver in place of the host queue.
typeOf Static Returns the event type for a kind, or nil for an unknown name.

Values

Value Type Description
on KindTypes Read-only. Exposes one ECS event type per kind, to observe at address zero.

Types

tecs.platform.events.Event record

Represents a borrowed platform event routed through the ECS event bus. Read-only. Exposes the Event type, discriminated by kind. The converter reuses the record passed to a handler, so anything retaining one takes a copy through events.copy.

record tecs.platform.events.Event is genericEvents.Event
    kind: string
    timestamp: number
    arrival: number
    scancode: integer
    keycode: integer
    modifiers: integer
    repeated: boolean
    down: boolean
    text: string
    start: integer
    length: integer
    candidates: {string}
    selected: integer
    horizontal: boolean
    x: number
    y: number
    dx: number
    dy: number
    normalX: number
    normalY: number
    button: integer
    clicks: integer
    wheelX: number
    wheelY: number
    wheelTicksX: integer
    wheelTicksY: integer
    flipped: boolean
    scale: number
    axis: integer
    value: number
    pressure: number
    eraser: boolean
    penState: integer
    which: number
    synthetic: boolean
    finger: string
    touchDevice: string
    touchpad: integer
    fingerIndex: integer
    sensor: integer
    sensorX: number
    sensorY: number
    sensorZ: number
    sensorData: {number}
    sensorTimestamp: number
    source: string
    mimeTypes: {string}
    owner: boolean
    recording: boolean
    data1: integer
    data2: integer
    sdlType: integer
end

Interfaces

Interface
genericEvents.Event

tecs.platform.events.Event.kind field

Read-only. Reports what happened and determines which other fields carry meaning.

tecs.platform.events.Event.kind: string

tecs.platform.events.Event.timestamp field

Read-only. Reports nanoseconds on the platform event clock. This clock orders events against each other, not against time.now.

tecs.platform.events.Event.timestamp: number

tecs.platform.events.Event.arrival field

Read-only. Reports monotonic seconds on the clock time.now reads, converted by the host from the event's platform timestamp. Nil for an event that did not come through the host queue, such as a replayed one.

tecs.platform.events.Event.arrival: number

tecs.platform.events.Event.scancode field

Read-only. Reports the physical key position, which is what a movement binding wants: WASD stays in the same place on every layout.

tecs.platform.events.Event.scancode: integer

tecs.platform.events.Event.keycode field

Read-only. Reports the key the layout produces, which is what a text binding and a prompt want. The event carries both because neither answers the other's question.

tecs.platform.events.Event.keycode: integer

tecs.platform.events.Event.modifiers field

Read-only. Reports modifier keys held when the event occurred as a mask.

tecs.platform.events.Event.modifiers: integer

tecs.platform.events.Event.repeated field

Read-only. Reports true when the platform repeats a held key rather than reporting a new press.

tecs.platform.events.Event.repeated: boolean

tecs.platform.events.Event.down field

Read-only. Reports whether the button or key went down.

tecs.platform.events.Event.down: boolean

tecs.platform.events.Event.text field

Read-only. Contains text committed or composed by an input method, or dropped onto the window.

tecs.platform.events.Event.text: string

tecs.platform.events.Event.start field

Read-only. Reports the cursor position within composing text.

tecs.platform.events.Event.start: integer

tecs.platform.events.Event.length field

Read-only. Reports the selection length within composing text.

tecs.platform.events.Event.length: integer

tecs.platform.events.Event.candidates field

Read-only. Contains candidates an input method offers. It is nil when the platform offers none.

tecs.platform.events.Event.candidates: {string}

tecs.platform.events.Event.selected field

Read-only. Reports the selected candidate index.

tecs.platform.events.Event.selected: integer

tecs.platform.events.Event.horizontal field

Read-only. Reports whether the platform lays its candidates out horizontally.

tecs.platform.events.Event.horizontal: boolean

tecs.platform.events.Event.x field

Read-only. Reports the pointer's x position in window coordinates.

tecs.platform.events.Event.x: number

tecs.platform.events.Event.y field

Read-only. Reports the pointer's y position in window coordinates.

tecs.platform.events.Event.y: number

tecs.platform.events.Event.dx field

Read-only. Reports horizontal movement since the previous event of this kind.

tecs.platform.events.Event.dx: number

tecs.platform.events.Event.dy field

Read-only. Reports vertical movement since the previous event of this kind.

tecs.platform.events.Event.dy: number

tecs.platform.events.Event.normalX field

Read-only. Reports horizontal pointer position as the platform reported it, in 0..1 across the window. The platform normalizes touch at source, so the event carries it unscaled as well as converted: a normalized position survives a resize and a window coordinate does not.

tecs.platform.events.Event.normalX: number

tecs.platform.events.Event.normalY field

Read-only. Reports vertical pointer position from 0 to 1 down the window.

tecs.platform.events.Event.normalY: number

tecs.platform.events.Event.button field

Read-only. Reports the mouse, gamepad or pen button.

tecs.platform.events.Event.button: integer

tecs.platform.events.Event.clicks field

Read-only. Reports the platform's count of quick successive presses for this button under its own double-click interval. One for a single click, two for a double, and up from there.

tecs.platform.events.Event.clicks: integer

tecs.platform.events.Event.wheelX field

Read-only. Reports horizontal wheel movement, with one meaning whatever the platform is set to: positive wheelY is a scroll away from the player and positive wheelX is a scroll to the right. A platform reporting natural scrolling sends the opposite pair and flags it, and the conversion undoes that, so nothing above binds a sign twice.

tecs.platform.events.Event.wheelX: number

tecs.platform.events.Event.wheelY field

Read-only. Reports vertical wheel movement under the same sign convention as wheelX.

tecs.platform.events.Event.wheelY: number

tecs.platform.events.Event.wheelTicksX field

Read-only. Reports horizontal wheel movement accumulated to whole notches by the platform, on the same sign convention. What a menu stepping one item per notch reads, rather than deciding for itself where a fraction of a notch becomes a step.

tecs.platform.events.Event.wheelTicksX: integer

tecs.platform.events.Event.wheelTicksY field

Read-only. Reports vertical whole-notch wheel movement under the same sign convention as wheelTicksX.

tecs.platform.events.Event.wheelTicksY: integer

tecs.platform.events.Event.flipped field

Read-only. Reports whether the platform marked this wheel event as flipped for its configured scroll direction. wheelX and wheelY remain normalized; a consumer that intentionally follows the user's scrolling preference can reverse the normalized pair once when this is true.

tecs.platform.events.Event.flipped: boolean

tecs.platform.events.Event.scale field

Read-only. Reports the zoom factor since the previous pinch event. Below one is a pinch closed, above one is a pinch opened.

tecs.platform.events.Event.scale: number

tecs.platform.events.Event.axis field

Read-only. Reports the gamepad or pen axis.

tecs.platform.events.Event.axis: integer

tecs.platform.events.Event.value field

Read-only. Reports the axis value in -1..1.

tecs.platform.events.Event.value: number

tecs.platform.events.Event.pressure field

Read-only. Reports finger pressure from 0 to 1 on a touch surface or gamepad touchpad. A pen reports its pressure as an axis instead, so a pen event leaves this holding whatever the last touch put there.

tecs.platform.events.Event.pressure: number

tecs.platform.events.Event.eraser field

Read-only. Reports whether the pen's eraser end is in use.

tecs.platform.events.Event.eraser: boolean

tecs.platform.events.Event.penState field

Read-only. Reports pen state at the instant of the event as a mask: the tip down, the eraser end in use, whether it is in proximity, and each barrel button. eraser and down answer for one stroke; this answers which barrel button is held right now. The bits are the platform's SDL_PEN_INPUT_* values. Not carried on the proximity events, which report no state.

tecs.platform.events.Event.penState: integer

tecs.platform.events.Event.which field

Read-only. Reports the device that produced the event: a gamepad, a keyboard, a mouse, a pen, a sensor, a display, or a window. These identifiers are 32 bits and fit a Lua number exactly.

tecs.platform.events.Event.which: number

tecs.platform.events.Event.synthetic field

Read-only. Reports true when the platform produced this mouse event from a touch or a pen rather than from a mouse. A game that also handles touch would otherwise act on the same gesture twice.

tecs.platform.events.Event.synthetic: boolean

tecs.platform.events.Event.finger field

Read-only. Reports the touch finger identity as an opaque string. The 64-bit value does not fit a double, so the event carries a string rather than numbers that might silently round.

tecs.platform.events.Event.finger: string

tecs.platform.events.Event.touchDevice field

Read-only. Reports the touch device identity as an opaque string.

tecs.platform.events.Event.touchDevice: string

tecs.platform.events.Event.touchpad field

Read-only. Reports the gamepad touchpad index. Position on the device identifies a touchpad finger, not a 64-bit id.

tecs.platform.events.Event.touchpad: integer

tecs.platform.events.Event.fingerIndex field

Read-only. Reports the finger's slot on the gamepad touchpad.

tecs.platform.events.Event.fingerIndex: integer

tecs.platform.events.Event.sensor field

Read-only. Reports the sensor identity.

tecs.platform.events.Event.sensor: integer

tecs.platform.events.Event.sensorX field

Read-only. Reports the first component of the latest sensor reading.

tecs.platform.events.Event.sensorX: number

tecs.platform.events.Event.sensorY field

Read-only. Reports the second component of the latest sensor reading.

tecs.platform.events.Event.sensorY: number

tecs.platform.events.Event.sensorZ field

Read-only. Reports the third component of the latest sensor reading.

tecs.platform.events.Event.sensorZ: number

tecs.platform.events.Event.sensorData field

Read-only. Contains the latest sensor reading. A gamepad sensor reports three components; a standalone sensor reports up to six.

tecs.platform.events.Event.sensorData: {number}

tecs.platform.events.Event.sensorTimestamp field

Read-only. Reports when the hardware took the reading, in nanoseconds on the sensor's own clock. Like timestamp it orders readings against each other and against nothing else, which is what integrating a rotation over them needs and is all it is for.

tecs.platform.events.Event.sensorTimestamp: number

tecs.platform.events.Event.source field

Read-only. Reports where a dropped file or text came from when the platform supplies a source.

tecs.platform.events.Event.source: string

tecs.platform.events.Event.mimeTypes field

Read-only. Lists the clipboard formats on offer.

tecs.platform.events.Event.mimeTypes: {string}

tecs.platform.events.Event.owner field

Read-only. Reports whether the clipboard's new contents belong to this application.

tecs.platform.events.Event.owner: boolean

tecs.platform.events.Event.recording field

Read-only. Reports whether an audio device records input.

tecs.platform.events.Event.recording: boolean

tecs.platform.events.Event.data1 field

Read-only. Reports the first window, display or user payload integer. A user event's code arrives in data1; the two data pointers beside it do not cross, since a pointer is not a value this vocabulary can carry.

tecs.platform.events.Event.data1: integer

tecs.platform.events.Event.data2 field

Read-only. Reports the second window, display or user payload integer.

tecs.platform.events.Event.data2: integer

tecs.platform.events.Event.sdlType field

Engine-owned. Stores the numeric platform event type and is the only useful field on unknown. Ordinary game code should ignore this field for known events.

tecs.platform.events.Event.sdlType: integer

tecs.platform.events.KindTypes record

Maps each event kind to an ECS event type observed at address zero.

A game asks for the kinds it wants rather than for the stream: world:observe(0, events.on.dropFile, handler) runs handler for dropped files and for nothing else. That is what a type per kind buys over one type carrying the kind, where every subscriber receives every kind and filters it back out again.

Written as a record rather than looked up by name, so a misspelled kind is a compile error on the key instead of an observer that is never called. events.typeOf is the same table for code holding a kind as a string.

The converter reuses the record an observer receives, so the borrow rule is the one this module states everywhere: read it, or copy it with events.copy, but do not keep it.

global record tecs.platform.events.KindTypes
    quit: Event
    terminating: Event
    lowMemory: Event
    appWillEnterBackground: Event
    appDidEnterBackground: Event
    appWillEnterForeground: Event
    appDidEnterForeground: Event
    localeChanged: Event
    themeChanged: Event
    displayOrientation: Event
    displayAdded: Event
    displayRemoved: Event
    displayMoved: Event
    displayScaleChanged: Event
    displayDesktopModeChanged: Event
    displayCurrentModeChanged: Event
    displayUsableBoundsChanged: Event
    windowShown: Event
    windowHidden: Event
    windowExposed: Event
    windowMoved: Event
    windowResized: Event
    windowPixelSizeChanged: Event
    windowMinimized: Event
    windowMaximized: Event
    windowRestored: Event
    windowMouseEnter: Event
    windowMouseLeave: Event
    windowFocusGained: Event
    windowFocusLost: Event
    windowCloseRequested: Event
    windowDisplayChanged: Event
    windowDisplayScaleChanged: Event
    windowSafeAreaChanged: Event
    windowOccluded: Event
    windowEnterFullscreen: Event
    windowLeaveFullscreen: Event
    keyDown: Event
    keyUp: Event
    textEditing: Event
    textCandidates: Event
    textInput: Event
    keymapChanged: Event
    keyboardAdded: Event
    keyboardRemoved: Event
    screenKeyboardShown: Event
    screenKeyboardHidden: Event
    mouseMotion: Event
    mouseDown: Event
    mouseUp: Event
    mouseWheel: Event
    mouseAdded: Event
    mouseRemoved: Event
    fingerDown: Event
    fingerUp: Event
    fingerMotion: Event
    fingerCanceled: Event
    pinchBegin: Event
    pinchUpdate: Event
    pinchEnd: Event
    penProximityIn: Event
    penProximityOut: Event
    penDown: Event
    penUp: Event
    penMotion: Event
    penButtonDown: Event
    penButtonUp: Event
    penAxis: Event
    gamepadAdded: Event
    gamepadRemoved: Event
    gamepadRemapped: Event
    gamepadButtonDown: Event
    gamepadButtonUp: Event
    gamepadAxis: Event
    gamepadSensor: Event
    gamepadTouchpadDown: Event
    gamepadTouchpadUp: Event
    gamepadTouchpadMotion: Event
    dropFile: Event
    dropText: Event
    dropBegin: Event
    dropComplete: Event
    dropPosition: Event
    clipboardUpdate: Event
    audioDeviceAdded: Event
    audioDeviceRemoved: Event
    audioDeviceFormatChanged: Event
    sensorUpdate: Event
    user: Event
    unknown: Event
end

tecs.platform.events.KindTypes.quit field

Read-only. Exposes the "quit" event type for a requested application shutdown, including a window close, SIGINT, or SIGTERM.

tecs.platform.events.KindTypes.quit: Event

tecs.platform.events.KindTypes.terminating field

Read-only. Exposes the "terminating" event type.

tecs.platform.events.KindTypes.terminating: Event

tecs.platform.events.KindTypes.lowMemory field

Read-only. Exposes the "lowMemory" event type.

tecs.platform.events.KindTypes.lowMemory: Event

tecs.platform.events.KindTypes.appWillEnterBackground field

Read-only. Exposes the "appWillEnterBackground" event type.

tecs.platform.events.KindTypes.appWillEnterBackground: Event

tecs.platform.events.KindTypes.appDidEnterBackground field

Read-only. Exposes the "appDidEnterBackground" event type.

tecs.platform.events.KindTypes.appDidEnterBackground: Event

tecs.platform.events.KindTypes.appWillEnterForeground field

Read-only. Exposes the "appWillEnterForeground" event type.

tecs.platform.events.KindTypes.appWillEnterForeground: Event

tecs.platform.events.KindTypes.appDidEnterForeground field

Read-only. Exposes the "appDidEnterForeground" event type.

tecs.platform.events.KindTypes.appDidEnterForeground: Event

tecs.platform.events.KindTypes.localeChanged field

Read-only. Exposes the "localeChanged" event type.

tecs.platform.events.KindTypes.localeChanged: Event

tecs.platform.events.KindTypes.themeChanged field

Read-only. Exposes the "themeChanged" event type.

tecs.platform.events.KindTypes.themeChanged: Event

tecs.platform.events.KindTypes.displayOrientation field

Read-only. Exposes the "displayOrientation" event type.

tecs.platform.events.KindTypes.displayOrientation: Event

tecs.platform.events.KindTypes.displayAdded field

Read-only. Exposes the "displayAdded" event type.

tecs.platform.events.KindTypes.displayAdded: Event

tecs.platform.events.KindTypes.displayRemoved field

Read-only. Exposes the "displayRemoved" event type.

tecs.platform.events.KindTypes.displayRemoved: Event

tecs.platform.events.KindTypes.displayMoved field

Read-only. Exposes the "displayMoved" event type.

tecs.platform.events.KindTypes.displayMoved: Event

tecs.platform.events.KindTypes.displayScaleChanged field

Read-only. Exposes the "displayScaleChanged" event type.

tecs.platform.events.KindTypes.displayScaleChanged: Event

tecs.platform.events.KindTypes.displayDesktopModeChanged field

Read-only. Exposes the "displayDesktopModeChanged" event type.

tecs.platform.events.KindTypes.displayDesktopModeChanged: Event

tecs.platform.events.KindTypes.displayCurrentModeChanged field

Read-only. Exposes the "displayCurrentModeChanged" event type.

tecs.platform.events.KindTypes.displayCurrentModeChanged: Event

tecs.platform.events.KindTypes.displayUsableBoundsChanged field

Read-only. Exposes the "displayUsableBoundsChanged" event type.

tecs.platform.events.KindTypes.displayUsableBoundsChanged: Event

tecs.platform.events.KindTypes.windowShown field

Read-only. Exposes the "windowShown" event type.

tecs.platform.events.KindTypes.windowShown: Event

tecs.platform.events.KindTypes.windowHidden field

Read-only. Exposes the "windowHidden" event type.

tecs.platform.events.KindTypes.windowHidden: Event

tecs.platform.events.KindTypes.windowExposed field

Read-only. Exposes the "windowExposed" event type.

tecs.platform.events.KindTypes.windowExposed: Event

tecs.platform.events.KindTypes.windowMoved field

Read-only. Exposes the "windowMoved" event type.

tecs.platform.events.KindTypes.windowMoved: Event

tecs.platform.events.KindTypes.windowResized field

Read-only. Exposes the "windowResized" event type.

tecs.platform.events.KindTypes.windowResized: Event

tecs.platform.events.KindTypes.windowPixelSizeChanged field

Read-only. Exposes the "windowPixelSizeChanged" event type.

tecs.platform.events.KindTypes.windowPixelSizeChanged: Event

tecs.platform.events.KindTypes.windowMinimized field

Read-only. Exposes the "windowMinimized" event type.

tecs.platform.events.KindTypes.windowMinimized: Event

tecs.platform.events.KindTypes.windowMaximized field

Read-only. Exposes the "windowMaximized" event type.

tecs.platform.events.KindTypes.windowMaximized: Event

tecs.platform.events.KindTypes.windowRestored field

Read-only. Exposes the "windowRestored" event type.

tecs.platform.events.KindTypes.windowRestored: Event

tecs.platform.events.KindTypes.windowMouseEnter field

Read-only. Exposes the "windowMouseEnter" event type.

tecs.platform.events.KindTypes.windowMouseEnter: Event

tecs.platform.events.KindTypes.windowMouseLeave field

Read-only. Exposes the "windowMouseLeave" event type.

tecs.platform.events.KindTypes.windowMouseLeave: Event

tecs.platform.events.KindTypes.windowFocusGained field

Read-only. Exposes the "windowFocusGained" event type.

tecs.platform.events.KindTypes.windowFocusGained: Event

tecs.platform.events.KindTypes.windowFocusLost field

Read-only. Exposes the "windowFocusLost" event type.

tecs.platform.events.KindTypes.windowFocusLost: Event

tecs.platform.events.KindTypes.windowCloseRequested field

Read-only. Exposes the "windowCloseRequested" event type.

tecs.platform.events.KindTypes.windowCloseRequested: Event

tecs.platform.events.KindTypes.windowDisplayChanged field

Read-only. Exposes the "windowDisplayChanged" event type.

tecs.platform.events.KindTypes.windowDisplayChanged: Event

tecs.platform.events.KindTypes.windowDisplayScaleChanged field

Read-only. Exposes the "windowDisplayScaleChanged" event type.

tecs.platform.events.KindTypes.windowDisplayScaleChanged: Event

tecs.platform.events.KindTypes.windowSafeAreaChanged field

Read-only. Exposes the "windowSafeAreaChanged" event type.

tecs.platform.events.KindTypes.windowSafeAreaChanged: Event

tecs.platform.events.KindTypes.windowOccluded field

Read-only. Exposes the "windowOccluded" event type.

tecs.platform.events.KindTypes.windowOccluded: Event

tecs.platform.events.KindTypes.windowEnterFullscreen field

Read-only. Exposes the "windowEnterFullscreen" event type.

tecs.platform.events.KindTypes.windowEnterFullscreen: Event

tecs.platform.events.KindTypes.windowLeaveFullscreen field

Read-only. Exposes the "windowLeaveFullscreen" event type.

tecs.platform.events.KindTypes.windowLeaveFullscreen: Event

tecs.platform.events.KindTypes.keyDown field

Read-only. Exposes the "keyDown" event type.

tecs.platform.events.KindTypes.keyDown: Event

tecs.platform.events.KindTypes.keyUp field

Read-only. Exposes the "keyUp" event type.

tecs.platform.events.KindTypes.keyUp: Event

tecs.platform.events.KindTypes.textEditing field

Read-only. Exposes the "textEditing" event type.

tecs.platform.events.KindTypes.textEditing: Event

tecs.platform.events.KindTypes.textCandidates field

Read-only. Exposes the "textCandidates" event type.

tecs.platform.events.KindTypes.textCandidates: Event

tecs.platform.events.KindTypes.textInput field

Read-only. Exposes the "textInput" event type.

tecs.platform.events.KindTypes.textInput: Event

tecs.platform.events.KindTypes.keymapChanged field

Read-only. Exposes the "keymapChanged" event type.

tecs.platform.events.KindTypes.keymapChanged: Event

tecs.platform.events.KindTypes.keyboardAdded field

Read-only. Exposes the "keyboardAdded" event type.

tecs.platform.events.KindTypes.keyboardAdded: Event

tecs.platform.events.KindTypes.keyboardRemoved field

Read-only. Exposes the "keyboardRemoved" event type.

tecs.platform.events.KindTypes.keyboardRemoved: Event

tecs.platform.events.KindTypes.screenKeyboardShown field

Read-only. Exposes the "screenKeyboardShown" event type.

tecs.platform.events.KindTypes.screenKeyboardShown: Event

tecs.platform.events.KindTypes.screenKeyboardHidden field

Read-only. Exposes the "screenKeyboardHidden" event type.

tecs.platform.events.KindTypes.screenKeyboardHidden: Event

tecs.platform.events.KindTypes.mouseMotion field

Read-only. Exposes the "mouseMotion" event type.

tecs.platform.events.KindTypes.mouseMotion: Event

tecs.platform.events.KindTypes.mouseDown field

Read-only. Exposes the "mouseDown" event type.

tecs.platform.events.KindTypes.mouseDown: Event

tecs.platform.events.KindTypes.mouseUp field

Read-only. Exposes the "mouseUp" event type.

tecs.platform.events.KindTypes.mouseUp: Event

tecs.platform.events.KindTypes.mouseWheel field

Read-only. Exposes the "mouseWheel" event type.

tecs.platform.events.KindTypes.mouseWheel: Event

tecs.platform.events.KindTypes.mouseAdded field

Read-only. Exposes the "mouseAdded" event type.

tecs.platform.events.KindTypes.mouseAdded: Event

tecs.platform.events.KindTypes.mouseRemoved field

Read-only. Exposes the "mouseRemoved" event type.

tecs.platform.events.KindTypes.mouseRemoved: Event

tecs.platform.events.KindTypes.fingerDown field

Read-only. Exposes the "fingerDown" event type.

tecs.platform.events.KindTypes.fingerDown: Event

tecs.platform.events.KindTypes.fingerUp field

Read-only. Exposes the "fingerUp" event type.

tecs.platform.events.KindTypes.fingerUp: Event

tecs.platform.events.KindTypes.fingerMotion field

Read-only. Exposes the "fingerMotion" event type.

tecs.platform.events.KindTypes.fingerMotion: Event

tecs.platform.events.KindTypes.fingerCanceled field

Read-only. Exposes the "fingerCanceled" event type.

tecs.platform.events.KindTypes.fingerCanceled: Event

tecs.platform.events.KindTypes.pinchBegin field

Read-only. Exposes the "pinchBegin" event type.

tecs.platform.events.KindTypes.pinchBegin: Event

tecs.platform.events.KindTypes.pinchUpdate field

Read-only. Exposes the "pinchUpdate" event type.

tecs.platform.events.KindTypes.pinchUpdate: Event

tecs.platform.events.KindTypes.pinchEnd field

Read-only. Exposes the "pinchEnd" event type.

tecs.platform.events.KindTypes.pinchEnd: Event

tecs.platform.events.KindTypes.penProximityIn field

Read-only. Exposes the "penProximityIn" event type.

tecs.platform.events.KindTypes.penProximityIn: Event

tecs.platform.events.KindTypes.penProximityOut field

Read-only. Exposes the "penProximityOut" event type.

tecs.platform.events.KindTypes.penProximityOut: Event

tecs.platform.events.KindTypes.penDown field

Read-only. Exposes the "penDown" event type.

tecs.platform.events.KindTypes.penDown: Event

tecs.platform.events.KindTypes.penUp field

Read-only. Exposes the "penUp" event type.

tecs.platform.events.KindTypes.penUp: Event

tecs.platform.events.KindTypes.penMotion field

Read-only. Exposes the "penMotion" event type.

tecs.platform.events.KindTypes.penMotion: Event

tecs.platform.events.KindTypes.penButtonDown field

Read-only. Exposes the "penButtonDown" event type.

tecs.platform.events.KindTypes.penButtonDown: Event

tecs.platform.events.KindTypes.penButtonUp field

Read-only. Exposes the "penButtonUp" event type.

tecs.platform.events.KindTypes.penButtonUp: Event

tecs.platform.events.KindTypes.penAxis field

Read-only. Exposes the "penAxis" event type.

tecs.platform.events.KindTypes.penAxis: Event

tecs.platform.events.KindTypes.gamepadAdded field

Read-only. Exposes the "gamepadAdded" event type.

tecs.platform.events.KindTypes.gamepadAdded: Event

tecs.platform.events.KindTypes.gamepadRemoved field

Read-only. Exposes the "gamepadRemoved" event type.

tecs.platform.events.KindTypes.gamepadRemoved: Event

tecs.platform.events.KindTypes.gamepadRemapped field

Read-only. Exposes the "gamepadRemapped" event type.

tecs.platform.events.KindTypes.gamepadRemapped: Event

tecs.platform.events.KindTypes.gamepadButtonDown field

Read-only. Exposes the "gamepadButtonDown" event type.

tecs.platform.events.KindTypes.gamepadButtonDown: Event

tecs.platform.events.KindTypes.gamepadButtonUp field

Read-only. Exposes the "gamepadButtonUp" event type.

tecs.platform.events.KindTypes.gamepadButtonUp: Event

tecs.platform.events.KindTypes.gamepadAxis field

Read-only. Exposes the "gamepadAxis" event type.

tecs.platform.events.KindTypes.gamepadAxis: Event

tecs.platform.events.KindTypes.gamepadSensor field

Read-only. Exposes the "gamepadSensor" event type.

tecs.platform.events.KindTypes.gamepadSensor: Event

tecs.platform.events.KindTypes.gamepadTouchpadDown field

Read-only. Exposes the "gamepadTouchpadDown" event type.

tecs.platform.events.KindTypes.gamepadTouchpadDown: Event

tecs.platform.events.KindTypes.gamepadTouchpadUp field

Read-only. Exposes the "gamepadTouchpadUp" event type.

tecs.platform.events.KindTypes.gamepadTouchpadUp: Event

tecs.platform.events.KindTypes.gamepadTouchpadMotion field

Read-only. Exposes the "gamepadTouchpadMotion" event type.

tecs.platform.events.KindTypes.gamepadTouchpadMotion: Event

tecs.platform.events.KindTypes.dropFile field

Read-only. Exposes the "dropFile" event type.

tecs.platform.events.KindTypes.dropFile: Event

tecs.platform.events.KindTypes.dropText field

Read-only. Exposes the "dropText" event type.

tecs.platform.events.KindTypes.dropText: Event

tecs.platform.events.KindTypes.dropBegin field

Read-only. Exposes the "dropBegin" event type.

tecs.platform.events.KindTypes.dropBegin: Event

tecs.platform.events.KindTypes.dropComplete field

Read-only. Exposes the "dropComplete" event type.

tecs.platform.events.KindTypes.dropComplete: Event

tecs.platform.events.KindTypes.dropPosition field

Read-only. Exposes the "dropPosition" event type.

tecs.platform.events.KindTypes.dropPosition: Event

tecs.platform.events.KindTypes.clipboardUpdate field

Read-only. Exposes the "clipboardUpdate" event type.

tecs.platform.events.KindTypes.clipboardUpdate: Event

tecs.platform.events.KindTypes.audioDeviceAdded field

Read-only. Exposes the "audioDeviceAdded" event type.

tecs.platform.events.KindTypes.audioDeviceAdded: Event

tecs.platform.events.KindTypes.audioDeviceRemoved field

Read-only. Exposes the "audioDeviceRemoved" event type.

tecs.platform.events.KindTypes.audioDeviceRemoved: Event

tecs.platform.events.KindTypes.audioDeviceFormatChanged field

Read-only. Exposes the "audioDeviceFormatChanged" event type.

tecs.platform.events.KindTypes.audioDeviceFormatChanged: Event

tecs.platform.events.KindTypes.sensorUpdate field

Read-only. Exposes the "sensorUpdate" event type.

tecs.platform.events.KindTypes.sensorUpdate: Event

tecs.platform.events.KindTypes.user field

Read-only. Exposes the "user" event type.

tecs.platform.events.KindTypes.user: Event

tecs.platform.events.KindTypes.unknown field

Read-only. Selects an event kind this build has no name for. Such an event carries sdlType and nothing else worth reading.

tecs.platform.events.KindTypes.unknown: Event

Functions

tecs.platform.events.copy Static

Returns an independent copy, for code that must retain an event past the handler that received it.

Shallow, which is enough because every field is a number, a string or a boolean except the three lists, and those are freshly built per event rather than reused. Allocates, so this is for the events a recorder or a tool keeps and not for the stream.

function tecs.platform.events.copy(event: Event): Event

Arguments

Name Type Description
event Event The borrowed event to copy.

Returns

Type Description
Event A new event record that the caller can retain.

tecs.platform.events.kinds Static

Returns every kind this build recognizes.

function tecs.platform.events.kinds(): {string}

Arguments

None.

Returns

Type Description
{string}

tecs.platform.events.push Static

Pushes a synthetic event onto SDL's own queue.

Takes the engine's vocabulary rather than an SDL union, so a test or a tool can inject input without knowing SDL's layout. Only the fields a kind uses are read.

This function fills payloads for the key, mouse, wheel, pen, gamepad, device, pinch, window and display kinds. It pushes any other recognized kind with its type and nothing else, which is what a kind whose payload nobody injects needs and is not what a caller expecting a full event would assume.

The function writes a wheel payload the way the platform does, so flipped sets the direction and the axes beside it are left as given. The conversion then negates them, which is what a caller asking for a flipped scroll is asking to see: the round trip is the normalization, not the identity.

The platform stamps the timestamp, so a pushed event arrives ordered against real ones rather than ahead of them.

function tecs.platform.events.push(kind: string, fields: Event)

Arguments

Name Type Description
kind string One of events.kinds(). An unrecognized name raises.
fields Event

Returns

None.

tecs.platform.events.source Static

Caller-writable. Installs a replay driver in place of the host queue. The driver invokes the handler for each recorded event.

function tecs.platform.events.source(handler: function(Event))

Arguments

Name Type Description
handler function(Event) Receives each event the replay source supplies.

Returns

None.

tecs.platform.events.typeOf Static

Returns the event type for a kind, or nil for an unknown name.

What on is for code holding a kind it cannot spell in source, which is the conversion itself and the debug tools.

function tecs.platform.events.typeOf(kind: string): Event

Arguments

Name Type Description
kind string A kind name as on spells it. Names are this build's, so a kind SDL added later is unknown here rather than an error.

Returns

Type Description
Event The event type to observe, or nil for a name this build does not carry.

Values

tecs.platform.events.on variable

Read-only. Exposes one ECS event type per kind, to observe at address zero. See events.on.

tecs.platform.events.on: KindTypes