# `tecs.platform.events`
Typed platform events produced by the Rust host.
Every kind is its own `nupp.events` declaration, so a world delivers a key
press to the observers of `KeyDown` and nothing else, and the twelve shapes
the kinds share are unions of the declarations that carry them. Kind strings
are a stable external data surface used by recordings and tools. Rust
translates `winit` events into these records and passes one ordered batch to
`tecs.application.Application:iterate`.
## Types
### `Event` _type_
```nupp
type Event = Quit
| WindowCloseRequested
| WindowResized
| WindowScaleChanged
| WindowFocusGained
| WindowFocusLost
| KeyDown
| KeyUp
| MouseMotion
| MouseDown
| MouseUp
| MouseWheel
| TextInput
| FingerDown
| FingerUp
| FingerMotion
| FingerCanceled
| GamepadAdded
| GamepadRemoved
| GamepadButtonDown
| GamepadButtonUp
| GamepadAxis
```
An event in one sealed host batch.
### `FingerCanceled` _record_
```nupp
record FingerCanceled
kind: "fingerCanceled"
timestamp: number
sequence: integer
window: integer
touchDevice: string
finger: string
x: number
y: number
dx: number
dy: number
normalX: number
normalY: number
pressure: number
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.fingerCanceled")`
A touch the platform cancelled.
#### Fields
##### `kind`
```nupp
kind: "fingerCanceled"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `touchDevice`
```nupp
touchDevice: string
```
##### `finger`
```nupp
finger: string
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `dx`
```nupp
dx: number
```
##### `dy`
```nupp
dy: number
```
##### `normalX`
```nupp
normalX: number
```
##### `normalY`
```nupp
normalY: number
```
##### `pressure`
```nupp
pressure: number
```
##### `down`
```nupp
down: boolean
```
### `FingerDown` _record_
```nupp
record FingerDown
kind: "fingerDown"
timestamp: number
sequence: integer
window: integer
touchDevice: string
finger: string
x: number
y: number
dx: number
dy: number
normalX: number
normalY: number
pressure: number
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.fingerDown")`
A finger touching the surface.
#### Fields
##### `kind`
```nupp
kind: "fingerDown"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `touchDevice`
```nupp
touchDevice: string
```
##### `finger`
```nupp
finger: string
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `dx`
```nupp
dx: number
```
##### `dy`
```nupp
dy: number
```
##### `normalX`
```nupp
normalX: number
```
##### `normalY`
```nupp
normalY: number
```
##### `pressure`
```nupp
pressure: number
```
##### `down`
```nupp
down: boolean
```
### `FingerMotion` _record_
```nupp
record FingerMotion
kind: "fingerMotion"
timestamp: number
sequence: integer
window: integer
touchDevice: string
finger: string
x: number
y: number
dx: number
dy: number
normalX: number
normalY: number
pressure: number
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.fingerMotion")`
A finger moving on the surface.
#### Fields
##### `kind`
```nupp
kind: "fingerMotion"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `touchDevice`
```nupp
touchDevice: string
```
##### `finger`
```nupp
finger: string
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `dx`
```nupp
dx: number
```
##### `dy`
```nupp
dy: number
```
##### `normalX`
```nupp
normalX: number
```
##### `normalY`
```nupp
normalY: number
```
##### `pressure`
```nupp
pressure: number
```
##### `down`
```nupp
down: boolean
```
### `FingerUp` _record_
```nupp
record FingerUp
kind: "fingerUp"
timestamp: number
sequence: integer
window: integer
touchDevice: string
finger: string
x: number
y: number
dx: number
dy: number
normalX: number
normalY: number
pressure: number
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.fingerUp")`
A finger leaving the surface.
#### Fields
##### `kind`
```nupp
kind: "fingerUp"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `touchDevice`
```nupp
touchDevice: string
```
##### `finger`
```nupp
finger: string
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `dx`
```nupp
dx: number
```
##### `dy`
```nupp
dy: number
```
##### `normalX`
```nupp
normalX: number
```
##### `normalY`
```nupp
normalY: number
```
##### `pressure`
```nupp
pressure: number
```
##### `down`
```nupp
down: boolean
```
### `FocusEvent` _type_
```nupp
type FocusEvent = WindowFocusGained | WindowFocusLost
```
A window focus transition.
Whichever kind carries this shape; an observer written against it fits any of them.
### `GamepadAdded` _record_
```nupp
record GamepadAdded
kind: "gamepadAdded"
timestamp: number
sequence: integer
window: integer
which: integer
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.gamepadAdded")`
A gamepad appearing.
#### Fields
##### `kind`
```nupp
kind: "gamepadAdded"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `which`
```nupp
which: integer
```
### `GamepadAxis` _record_
```nupp
record GamepadAxis
kind: "gamepadAxis"
timestamp: number
sequence: integer
window: integer
which: integer
axis: integer
value: number
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.gamepadAxis")`
A gamepad axis reading.
#### Fields
##### `kind`
```nupp
kind: "gamepadAxis"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `which`
```nupp
which: integer
```
##### `axis`
```nupp
axis: integer
```
##### `value`
```nupp
value: number
```
### `GamepadAxisEvent` _type_
```nupp
type GamepadAxisEvent = GamepadAxis
```
A gamepad axis reading.
### `GamepadButtonDown` _record_
```nupp
record GamepadButtonDown
kind: "gamepadButtonDown"
timestamp: number
sequence: integer
window: integer
which: integer
button: integer
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.gamepadButtonDown")`
A gamepad button going down.
#### Fields
##### `kind`
```nupp
kind: "gamepadButtonDown"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `which`
```nupp
which: integer
```
##### `button`
```nupp
button: integer
```
##### `down`
```nupp
down: boolean
```
### `GamepadButtonEvent` _type_
```nupp
type GamepadButtonEvent = GamepadButtonDown | GamepadButtonUp
```
A gamepad button transition.
Whichever kind carries this shape; an observer written against it fits any of them.
### `GamepadButtonUp` _record_
```nupp
record GamepadButtonUp
kind: "gamepadButtonUp"
timestamp: number
sequence: integer
window: integer
which: integer
button: integer
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.gamepadButtonUp")`
A gamepad button coming up.
#### Fields
##### `kind`
```nupp
kind: "gamepadButtonUp"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `which`
```nupp
which: integer
```
##### `button`
```nupp
button: integer
```
##### `down`
```nupp
down: boolean
```
### `GamepadDeviceEvent` _type_
```nupp
type GamepadDeviceEvent = GamepadAdded | GamepadRemoved
```
A gamepad appearing or going away.
Compatibility surface: `which` names the device rather than the window.
`window` is zero because a gamepad belongs to no window.
Whichever kind carries this shape; an observer written against it fits any of them.
### `GamepadRemoved` _record_
```nupp
record GamepadRemoved
kind: "gamepadRemoved"
timestamp: number
sequence: integer
window: integer
which: integer
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.gamepadRemoved")`
A gamepad going away.
#### Fields
##### `kind`
```nupp
kind: "gamepadRemoved"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `which`
```nupp
which: integer
```
### `KeyDown` _record_
```nupp
record KeyDown
kind: "keyDown"
timestamp: number
sequence: integer
window: integer
physicalKey: string
logicalKey: string?
text: string?
modifiers: integer
repeated: boolean
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.keyDown")`
A key going down.
#### Fields
##### `kind`
```nupp
kind: "keyDown"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `physicalKey`
```nupp
physicalKey: string
```
##### `logicalKey`
```nupp
logicalKey: string?
```
##### `text`
```nupp
text: string?
```
##### `modifiers`
```nupp
modifiers: integer
```
##### `repeated`
```nupp
repeated: boolean
```
##### `down`
```nupp
down: boolean
```
### `KeyEvent` _type_
```nupp
type KeyEvent = KeyDown | KeyUp
```
A physical and logical keyboard transition.
Whichever kind carries this shape; an observer written against it fits any of them.
### `KeyUp` _record_
```nupp
record KeyUp
kind: "keyUp"
timestamp: number
sequence: integer
window: integer
physicalKey: string
logicalKey: string?
text: string?
modifiers: integer
repeated: boolean
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.keyUp")`
A key coming up.
#### Fields
##### `kind`
```nupp
kind: "keyUp"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `physicalKey`
```nupp
physicalKey: string
```
##### `logicalKey`
```nupp
logicalKey: string?
```
##### `text`
```nupp
text: string?
```
##### `modifiers`
```nupp
modifiers: integer
```
##### `repeated`
```nupp
repeated: boolean
```
##### `down`
```nupp
down: boolean
```
### `Kind` _type_
```nupp
type Kind = "quit"
| "windowCloseRequested"
| "windowResized"
| "windowScaleChanged"
| "windowFocusGained"
| "windowFocusLost"
| "keyDown"
| "keyUp"
| "mouseMotion"
| "mouseDown"
| "mouseUp"
| "mouseWheel"
| "textInput"
| "fingerDown"
| "fingerUp"
| "fingerMotion"
| "fingerCanceled"
| "gamepadAdded"
| "gamepadRemoved"
| "gamepadButtonDown"
| "gamepadButtonUp"
| "gamepadAxis"
```
A platform event kind supported by the Rust host.
### `MouseDown` _record_
```nupp
record MouseDown
kind: "mouseDown"
timestamp: number
sequence: integer
window: integer
x: number
y: number
button: integer
clicks: integer
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.mouseDown")`
A pointer button going down.
#### Fields
##### `kind`
```nupp
kind: "mouseDown"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `button`
```nupp
button: integer
```
##### `clicks`
```nupp
clicks: integer
```
##### `down`
```nupp
down: boolean
```
### `MouseMotion` _record_
```nupp
record MouseMotion
kind: "mouseMotion"
timestamp: number
sequence: integer
window: integer
x: number
y: number
dx: number
dy: number
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.mouseMotion")`
An absolute pointer position and optional relative movement.
#### Fields
##### `kind`
```nupp
kind: "mouseMotion"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `dx`
```nupp
dx: number
```
##### `dy`
```nupp
dy: number
```
### `MouseUp` _record_
```nupp
record MouseUp
kind: "mouseUp"
timestamp: number
sequence: integer
window: integer
x: number
y: number
button: integer
clicks: integer
down: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.mouseUp")`
A pointer button coming up.
#### Fields
##### `kind`
```nupp
kind: "mouseUp"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `button`
```nupp
button: integer
```
##### `clicks`
```nupp
clicks: integer
```
##### `down`
```nupp
down: boolean
```
### `MouseWheel` _record_
```nupp
record MouseWheel
kind: "mouseWheel"
timestamp: number
sequence: integer
window: integer
x: number
y: number
wheelX: number
wheelY: number
wheelTicksX: integer
wheelTicksY: integer
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.mouseWheel")`
A normalized pointer wheel movement.
#### Fields
##### `kind`
```nupp
kind: "mouseWheel"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `x`
```nupp
x: number
```
##### `y`
```nupp
y: number
```
##### `wheelX`
```nupp
wheelX: number
```
##### `wheelY`
```nupp
wheelY: number
```
##### `wheelTicksX`
```nupp
wheelTicksX: integer
```
##### `wheelTicksY`
```nupp
wheelTicksY: integer
```
### `PointerButtonEvent` _type_
```nupp
type PointerButtonEvent = MouseDown | MouseUp
```
A pointer button transition.
Whichever kind carries this shape; an observer written against it fits any of them.
### `PointerMoveEvent` _type_
```nupp
type PointerMoveEvent = MouseMotion
```
An absolute pointer position and optional relative movement.
### `Quit` _record_
```nupp
record Quit
kind: "quit"
timestamp: number
sequence: integer
window: integer
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.quit")`
A process quit request.
#### Fields
##### `kind`
```nupp
kind: "quit"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
### `QuitEvent` _type_
```nupp
type QuitEvent = Quit | WindowCloseRequested
```
A process or window close request.
Whichever kind carries this shape; an observer written against it fits any of them.
### `ResizeEvent` _type_
```nupp
type ResizeEvent = WindowResized | WindowScaleChanged
```
A logical window size change.
Whichever kind carries this shape; an observer written against it fits any of them.
### `TextEvent` _type_
```nupp
type TextEvent = TextInput
```
Text committed by the platform input method.
### `TextInput` _record_
```nupp
record TextInput
kind: "textInput"
timestamp: number
sequence: integer
window: integer
text: string
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.textInput")`
Text committed by the platform input method.
#### Fields
##### `kind`
```nupp
kind: "textInput"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `text`
```nupp
text: string
```
### `TouchEvent` _type_
```nupp
type TouchEvent = FingerDown | FingerUp | FingerMotion | FingerCanceled
```
One finger on a touch surface.
Compatibility surface: `touchDevice` and `finger` are stable field names,
and both stay strings because a device and a finger are 64-bit identities
that a Lua number would round together.
Whichever kind carries this shape; an observer written against it fits any of them.
### `WheelEvent` _type_
```nupp
type WheelEvent = MouseWheel
```
A normalized pointer wheel movement.
### `WindowCloseRequested` _record_
```nupp
record WindowCloseRequested
kind: "windowCloseRequested"
timestamp: number
sequence: integer
window: integer
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.windowCloseRequested")`
A close request for one window.
#### Fields
##### `kind`
```nupp
kind: "windowCloseRequested"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
### `WindowFocusGained` _record_
```nupp
record WindowFocusGained
kind: "windowFocusGained"
timestamp: number
sequence: integer
window: integer
focused: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.windowFocusGained")`
A window gaining focus.
#### Fields
##### `kind`
```nupp
kind: "windowFocusGained"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `focused`
```nupp
focused: boolean
```
### `WindowFocusLost` _record_
```nupp
record WindowFocusLost
kind: "windowFocusLost"
timestamp: number
sequence: integer
window: integer
focused: boolean
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.windowFocusLost")`
A window losing focus.
#### Fields
##### `kind`
```nupp
kind: "windowFocusLost"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `focused`
```nupp
focused: boolean
```
### `WindowResized` _record_
```nupp
record WindowResized
kind: "windowResized"
timestamp: number
sequence: integer
window: integer
width: integer
height: integer
pixelWidth: integer
pixelHeight: integer
scaleFactor: number
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.windowResized")`
A logical window resize.
#### Fields
##### `kind`
```nupp
kind: "windowResized"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `width`
```nupp
width: integer
```
##### `height`
```nupp
height: integer
```
##### `pixelWidth`
```nupp
pixelWidth: integer
```
##### `pixelHeight`
```nupp
pixelHeight: integer
```
##### `scaleFactor`
```nupp
scaleFactor: number
```
### `WindowScaleChanged` _record_
```nupp
record WindowScaleChanged
kind: "windowScaleChanged"
timestamp: number
sequence: integer
window: integer
width: integer
height: integer
pixelWidth: integer
pixelHeight: integer
scaleFactor: number
end
```
`@derive(events.Event)` `@event(name="tecs.platform.events.windowScaleChanged")`
A scale-factor change with the resulting logical size.
#### Fields
##### `kind`
```nupp
kind: "windowScaleChanged"
```
##### `timestamp`
```nupp
timestamp: number
```
##### `sequence`
```nupp
sequence: integer
```
##### `window`
```nupp
window: integer
```
##### `width`
```nupp
width: integer
```
##### `height`
```nupp
height: integer
```
##### `pixelWidth`
```nupp
pixelWidth: integer
```
##### `pixelHeight`
```nupp
pixelHeight: integer
```
##### `scaleFactor`
```nupp
scaleFactor: number
```
## Functions
### `closeRequested` _function_
```nupp
function closeRequested(window: integer?, timestamp: number?, sequence: integer?): QuitEvent
```
Constructs a close request for one window.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `QuitEvent` | |
### `dispatch` _function_
```nupp
function dispatch(exclusive world: ecs.World, event: Event): nil
```
Delivers one translated event to the world's observers of its kind.
The host's instance is delivered as it is: nothing is copied or constructed,
and observers receive it as a borrow for the call.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `exclusive world` | `ecs.World` | the receiving world |
| `event` | `Event` | the translated platform event |
#### Returns
| Type | Description |
| --- | --- |
| `nil` | |
### `focused` _function_
```nupp
function focused(focused: boolean, window: integer?, timestamp: number?, sequence: integer?): FocusEvent
```
Constructs a window focus transition.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `focused` | `boolean` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `FocusEvent` | |
### `gamepadAxis` _function_
```nupp
function gamepadAxis(which: integer, axis: integer, value: number, timestamp: number?, sequence: integer?): GamepadAxisEvent
```
Constructs a gamepad axis reading.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `which` | `integer` | the device identifier the backend issued |
| `axis` | `integer` | the axis code `tecs.input` resolves a name to |
| `value` | `number` | the reading from -1 to 1, with a trigger running zero to one |
| `timestamp` | `number?` | the host time the platform reported |
| `sequence` | `integer?` | the host's ordering number for the batch |
#### Returns
| Type | Description |
| --- | --- |
| `GamepadAxisEvent` | the constructed axis event |
#### Raises
- when the axis code is not positive
### `gamepadButton` _function_
```nupp
function gamepadButton(down: boolean, which: integer, button: integer, timestamp: number?, sequence: integer?): GamepadButtonEvent
```
Constructs a gamepad button transition.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `down` | `boolean` | whether the button went down rather than came up |
| `which` | `integer` | the device identifier the backend issued |
| `button` | `integer` | the positional button code `tecs.input` resolves a name to |
| `timestamp` | `number?` | the host time the platform reported |
| `sequence` | `integer?` | the host's ordering number for the batch |
#### Returns
| Type | Description |
| --- | --- |
| `GamepadButtonEvent` | the constructed button event |
#### Raises
- when the button code is not positive
### `gamepadDevice` _function_
```nupp
function gamepadDevice(added: boolean, which: integer, timestamp: number?, sequence: integer?): GamepadDeviceEvent
```
Constructs a gamepad appearing or going away.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `added` | `boolean` | whether the device appeared rather than went away |
| `which` | `integer` | the device identifier the backend issued |
| `timestamp` | `number?` | the host time the platform reported |
| `sequence` | `integer?` | the host's ordering number for the batch |
#### Returns
| Type | Description |
| --- | --- |
| `GamepadDeviceEvent` | the constructed device event |
### `key` _function_
```nupp
function key(down: boolean, physicalKey: string, logicalKey: string?, text: string?, modifiers: integer?, repeated: boolean?, window: integer?, timestamp: number?, sequence: integer?): KeyEvent
```
Constructs a keyboard transition.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `down` | `boolean` | |
| `physicalKey` | `string` | |
| `logicalKey` | `string?` | |
| `text` | `string?` | |
| `modifiers` | `integer?` | |
| `repeated` | `boolean?` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `KeyEvent` | |
### `kinds` _function_
```nupp
function kinds(): {string}
```
Returns every platform event kind, in the union's declared order.
Compatibility surface: each string is the externally typed kind an agent
names over the debug protocol, so the spellings here are the same ones
`Kind` declares and must not change with a module move. The union is a
type and cannot be read at run time, so a caller that needs the kinds as
data reads them here rather than keeping a second copy that drifts.
#### Returns
| Type | Description |
| --- | --- |
| `{string}` | a fresh caller-owned list of the twenty-two kind strings |
### `pointerButton` _function_
```nupp
function pointerButton(down: boolean, button: integer, x: number, y: number, clicks: integer?, window: integer?, timestamp: number?, sequence: integer?): PointerButtonEvent
```
Constructs a pointer button transition.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `down` | `boolean` | |
| `button` | `integer` | |
| `x` | `number` | |
| `y` | `number` | |
| `clicks` | `integer?` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `PointerButtonEvent` | |
### `pointerMoved` _function_
```nupp
function pointerMoved(x: number, y: number, dx: number?, dy: number?, window: integer?, timestamp: number?, sequence: integer?): PointerMoveEvent
```
Constructs an absolute pointer movement.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `x` | `number` | |
| `y` | `number` | |
| `dx` | `number?` | |
| `dy` | `number?` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `PointerMoveEvent` | |
### `quit` _function_
```nupp
function quit(window: integer?, timestamp: number?, sequence: integer?): QuitEvent
```
Constructs a process or window close request.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `QuitEvent` | |
### `resized` _function_
```nupp
function resized(width: integer, height: integer, window: integer?, scaleFactor: number?, timestamp: number?, sequence: integer?, pixelWidth: integer?, pixelHeight: integer?): ResizeEvent
```
Constructs a logical window resize.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `width` | `integer` | |
| `height` | `integer` | |
| `window` | `integer?` | |
| `scaleFactor` | `number?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
| `pixelWidth` | `integer?` | |
| `pixelHeight` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `ResizeEvent` | |
### `scaleChanged` _function_
```nupp
function scaleChanged(scaleFactor: number, width: integer, height: integer, window: integer?, timestamp: number?, sequence: integer?, pixelWidth: integer?, pixelHeight: integer?): ResizeEvent
```
Constructs a scale-factor change with the resulting logical size.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `scaleFactor` | `number` | |
| `width` | `integer` | |
| `height` | `integer` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
| `pixelWidth` | `integer?` | |
| `pixelHeight` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `ResizeEvent` | |
### `text` _function_
```nupp
function text(text: string, window: integer?, timestamp: number?, sequence: integer?): TextEvent
```
Constructs committed text input.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `text` | `string` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `TextEvent` | |
### `touch` _function_
```nupp
function touch(phase: "fingerDown" | "fingerUp" | "fingerMotion" | "fingerCanceled", touchDevice: string, finger: string, x: number, y: number, normalX: number?, normalY: number?, pressure: number?, dx: number?, dy: number?, window: integer?, timestamp: number?, sequence: integer?): TouchEvent
```
Constructs one finger's transition or movement.
`x` and `y` are in the window's logical coordinates, `normalX` and `normalY`
run from zero to one across the touch surface, and `pressure` runs from zero
to one where the surface reports it and is one where it does not.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `phase` | `"fingerDown" | "fingerUp" | "fingerMotion" | "fingerCanceled"` | the finger's transition, spelled as the event kind |
| `touchDevice` | `string` | the touch surface's opaque identity |
| `finger` | `string` | the finger's opaque identity on that surface |
| `x` | `number` | the position in logical window coordinates |
| `y` | `number` | the position in logical window coordinates |
| `normalX` | `number?` | the position across the surface, from zero to one |
| `normalY` | `number?` | the position down the surface, from zero to one |
| `pressure` | `number?` | the reported pressure from zero to one |
| `dx` | `number?` | the movement since the previous event, in logical coordinates |
| `dy` | `number?` | the movement since the previous event, in logical coordinates |
| `window` | `integer?` | the window the touch is over |
| `timestamp` | `number?` | the host time the platform reported |
| `sequence` | `integer?` | the host's ordering number for the batch |
#### Returns
| Type | Description |
| --- | --- |
| `TouchEvent` | the constructed touch event |
#### Raises
- when the finger identity is empty
### `wheel` _function_
```nupp
function wheel(wheelX: number, wheelY: number, ticksX: integer?, ticksY: integer?, x: number?, y: number?, window: integer?, timestamp: number?, sequence: integer?): WheelEvent
```
Constructs normalized pointer wheel movement.
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `wheelX` | `number` | |
| `wheelY` | `number` | |
| `ticksX` | `integer?` | |
| `ticksY` | `integer?` | |
| `x` | `number?` | |
| `y` | `number?` | |
| `window` | `integer?` | |
| `timestamp` | `number?` | |
| `sequence` | `integer?` | |
#### Returns
| Type | Description |
| --- | --- |
| `WheelEvent` | |