# `tecs.platform.window`
## Overview
::: api-overview
**functions**
- [`applyState`](#tecs.platform.window.applyState)
- [`attach`](#tecs.platform.window.attach)
- [`detach`](#tecs.platform.window.detach)
- [`drainCommands`](#tecs.platform.window.drainCommands)
- [`handleEvent`](#tecs.platform.window.handleEvent)
- [`newWindow`](#tecs.platform.window.newWindow)
- [`reportFailure`](#tecs.platform.window.reportFailure)
- [`takeFailures`](#tecs.platform.window.takeFailures)
**types**
- [`Command`](#tecs.platform.window.Command)
- [`CommandFailure`](#tecs.platform.window.CommandFailure)
- [`CreateOptions`](#tecs.platform.window.CreateOptions)
- [`CursorGrab`](#tecs.platform.window.CursorGrab)
- [`HostState`](#tecs.platform.window.HostState)
- [`Options`](#tecs.platform.window.Options)
- [`RequestRedrawCommand`](#tecs.platform.window.RequestRedrawCommand)
- [`SetCursorGrabCommand`](#tecs.platform.window.SetCursorGrabCommand)
- [`SetCursorVisibleCommand`](#tecs.platform.window.SetCursorVisibleCommand)
- [`SetFullscreenCommand`](#tecs.platform.window.SetFullscreenCommand)
- [`SetPositionCommand`](#tecs.platform.window.SetPositionCommand)
- [`SetResizableCommand`](#tecs.platform.window.SetResizableCommand)
- [`SetSizeCommand`](#tecs.platform.window.SetSizeCommand)
- [`SetTitleCommand`](#tecs.platform.window.SetTitleCommand)
- [`SetVisibleCommand`](#tecs.platform.window.SetVisibleCommand)
- [`Window`](#tecs.platform.window.Window)
:::
::: api-group
## Functions
::: api-item tecs.platform.window.applyState
### `applyState` _function_
```nupp
function(exclusive window: Window, state: HostState)
```
Replaces observed state after the host applies commands or reads the OS.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the attached window contract
`state` - [`HostState`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.HostState)
: the complete new state
:::
::: api-item tecs.platform.window.attach
### `attach` _function_
```nupp
function(exclusive window: Window, state: HostState)
```
Attaches the OS window and atomically installs its initial observed state.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the contract the host created the OS window for
`state` - [`HostState`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.HostState)
: the complete initial state
#### Raises
| Type | Condition |
| --- | --- |
| `string` | when already attached or when the state is invalid |
:::
::: api-item tecs.platform.window.detach
### `detach` _function_
```nupp
function(exclusive window: Window)
```
Detaches an OS window after host teardown.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the contract to detach
:::
::: api-item tecs.platform.window.drainCommands
### `drainCommands` _function_
```nupp
function(exclusive window: Window): {Command}
```
Removes the current pending command batch for the host to process.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the window whose requests the host is draining
#### Returns
`{`[`Command`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Command)`}`
: the ordered command batch, which the caller owns
:::
::: api-item tecs.platform.window.handleEvent
### `handleEvent` _function_
```nupp
function(exclusive window: Window, event: platformevents.Event)
```
Folds a translated window event before game observers receive it.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the window contract receiving the event
`event` - [`platformevents.Event`](../../../../modules/tecs/platform/events/index.html#tecs.platform.events.Event)
: the ordered platform event
:::
::: api-item tecs.platform.window.newWindow
### `newWindow` _function_
```nupp
function(options: Options?): Window
```
Creates a detached window contract without opening an OS window.
#### Arguments
`options` - [`Options`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Options)`?`
: the copied and validated creation options
#### Returns
[`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: a window ready for the Rust host to attach
:::
::: api-item tecs.platform.window.reportFailure
### `reportFailure` _function_
```nupp
function(exclusive window: Window, serial: integer, reason: string)
```
Records a non-empty operational failure for one command.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the originating window
`serial` - `integer`
: the rejected command serial
`reason` - `string`
: the host failure suitable for diagnostics
:::
::: api-item tecs.platform.window.takeFailures
### `takeFailures` _function_
```nupp
function(exclusive window: Window): {CommandFailure}
```
Removes the current command failures for game-side diagnostics.
#### Arguments
`exclusive window` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
: the window whose failures are consumed
#### Returns
`{`[`CommandFailure`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CommandFailure)`}`
: the ordered failure batch, which the caller owns
:::
:::
::: api-group
## Types
::: api-item tecs.platform.window.Command
### `Command` _type_
```nupp
type Command = SetTitleCommand
| SetSizeCommand
| SetPositionCommand
| SetVisibleCommand
| SetResizableCommand
| SetFullscreenCommand
| SetCursorVisibleCommand
| SetCursorGrabCommand
| RequestRedrawCommand
```
One command drained by the Rust `winit` adapter.
:::
::: api-item tecs.platform.window.CommandFailure
### `CommandFailure` _record_
```nupp
record CommandFailure
```
A host rejection associated with one command serial.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.CommandFailure.constructor)
**fields**
- [`reason`](#tecs.platform.window.CommandFailure.reason)
- [`serial`](#tecs.platform.window.CommandFailure.serial)
:::
::: api-item tecs.platform.window.CommandFailure.constructor
#### `constructor` _constructor_
```nupp
function(serial: integer, reason: string): tecs.platform.window.CommandFailure
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`serial` - `integer`
: Required.
`reason` - `string`
: Required.
##### Returns
[`tecs.platform.window.CommandFailure`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CommandFailure)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").CommandFailure(
serial = serial,
reason = reason
)
```
:::
::: api-item tecs.platform.window.CommandFailure.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.CommandFailure.reason
#### `reason` _field_
```nupp
reason: string
```
:::
:::
::: api-item tecs.platform.window.CreateOptions
### `CreateOptions` _record_
```nupp
record CreateOptions
```
The validated creation request read by the Rust host.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.CreateOptions.constructor)
**fields**
- [`alwaysOnTop`](#tecs.platform.window.CreateOptions.alwaysOnTop)
- [`decorations`](#tecs.platform.window.CreateOptions.decorations)
- [`fullscreen`](#tecs.platform.window.CreateOptions.fullscreen)
- [`height`](#tecs.platform.window.CreateOptions.height)
- [`maxHeight`](#tecs.platform.window.CreateOptions.maxHeight)
- [`maxWidth`](#tecs.platform.window.CreateOptions.maxWidth)
- [`minHeight`](#tecs.platform.window.CreateOptions.minHeight)
- [`minWidth`](#tecs.platform.window.CreateOptions.minWidth)
- [`resizable`](#tecs.platform.window.CreateOptions.resizable)
- [`title`](#tecs.platform.window.CreateOptions.title)
- [`transparent`](#tecs.platform.window.CreateOptions.transparent)
- [`visible`](#tecs.platform.window.CreateOptions.visible)
- [`width`](#tecs.platform.window.CreateOptions.width)
- [`x`](#tecs.platform.window.CreateOptions.x)
- [`y`](#tecs.platform.window.CreateOptions.y)
:::
::: api-item tecs.platform.window.CreateOptions.constructor
#### `constructor` _constructor_
```nupp
function(
title: string,
width: integer,
height: integer,
resizable: boolean,
fullscreen: boolean,
decorations: boolean,
visible: boolean,
alwaysOnTop: boolean,
transparent: boolean,
x: integer?,
y: integer?,
minWidth: integer?,
minHeight: integer?,
maxWidth: integer?,
maxHeight: integer?
): tecs.platform.window.CreateOptions
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`title` - `string`
: Required.
`width` - `integer`
: Required.
`height` - `integer`
: Required.
`resizable` - `boolean`
: Required.
`fullscreen` - `boolean`
: Required.
`decorations` - `boolean`
: Required.
`visible` - `boolean`
: Required.
`alwaysOnTop` - `boolean`
: Required.
`transparent` - `boolean`
: Required.
`x` - `integer?`
: Optional. Defaults to `nil`.
`y` - `integer?`
: Optional. Defaults to `nil`.
`minWidth` - `integer?`
: Optional. Defaults to `nil`.
`minHeight` - `integer?`
: Optional. Defaults to `nil`.
`maxWidth` - `integer?`
: Optional. Defaults to `nil`.
`maxHeight` - `integer?`
: Optional. Defaults to `nil`.
##### Returns
[`tecs.platform.window.CreateOptions`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CreateOptions)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").CreateOptions(
title = title,
width = width,
height = height,
resizable = resizable,
fullscreen = fullscreen,
decorations = decorations,
visible = visible,
alwaysOnTop = alwaysOnTop,
transparent = transparent
)
```
:::
::: api-item tecs.platform.window.CreateOptions.title
#### `title` _field_
```nupp
title: string
```
:::
::: api-item tecs.platform.window.CreateOptions.width
#### `width` _field_
```nupp
width: integer
```
:::
::: api-item tecs.platform.window.CreateOptions.height
#### `height` _field_
```nupp
height: integer
```
:::
::: api-item tecs.platform.window.CreateOptions.resizable
#### `resizable` _field_
```nupp
resizable: boolean
```
:::
::: api-item tecs.platform.window.CreateOptions.fullscreen
#### `fullscreen` _field_
```nupp
fullscreen: boolean
```
:::
::: api-item tecs.platform.window.CreateOptions.decorations
#### `decorations` _field_
```nupp
decorations: boolean
```
:::
::: api-item tecs.platform.window.CreateOptions.visible
#### `visible` _field_
```nupp
visible: boolean
```
:::
::: api-item tecs.platform.window.CreateOptions.alwaysOnTop
#### `alwaysOnTop` _field_
```nupp
alwaysOnTop: boolean
```
:::
::: api-item tecs.platform.window.CreateOptions.transparent
#### `transparent` _field_
```nupp
transparent: boolean
```
:::
::: api-item tecs.platform.window.CreateOptions.x
#### `x` _field_
```nupp
x: integer?
```
:::
::: api-item tecs.platform.window.CreateOptions.y
#### `y` _field_
```nupp
y: integer?
```
:::
::: api-item tecs.platform.window.CreateOptions.minWidth
#### `minWidth` _field_
```nupp
minWidth: integer?
```
:::
::: api-item tecs.platform.window.CreateOptions.minHeight
#### `minHeight` _field_
```nupp
minHeight: integer?
```
:::
::: api-item tecs.platform.window.CreateOptions.maxWidth
#### `maxWidth` _field_
```nupp
maxWidth: integer?
```
:::
::: api-item tecs.platform.window.CreateOptions.maxHeight
#### `maxHeight` _field_
```nupp
maxHeight: integer?
```
:::
:::
::: api-item tecs.platform.window.CursorGrab
### `CursorGrab` _type_
```nupp
type CursorGrab = "none" | "confined" | "locked"
```
A pointer confinement mode understood by `winit`.
:::
::: api-item tecs.platform.window.HostState
### `HostState` _record_
```nupp
record HostState
```
A complete host observation applied atomically to a window.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.HostState.constructor)
**fields**
- [`cursorGrab`](#tecs.platform.window.HostState.cursorGrab)
- [`cursorVisible`](#tecs.platform.window.HostState.cursorVisible)
- [`focused`](#tecs.platform.window.HostState.focused)
- [`fullscreen`](#tecs.platform.window.HostState.fullscreen)
- [`height`](#tecs.platform.window.HostState.height)
- [`id`](#tecs.platform.window.HostState.id)
- [`maximized`](#tecs.platform.window.HostState.maximized)
- [`minimized`](#tecs.platform.window.HostState.minimized)
- [`occluded`](#tecs.platform.window.HostState.occluded)
- [`pixelHeight`](#tecs.platform.window.HostState.pixelHeight)
- [`pixelWidth`](#tecs.platform.window.HostState.pixelWidth)
- [`resizable`](#tecs.platform.window.HostState.resizable)
- [`scaleFactor`](#tecs.platform.window.HostState.scaleFactor)
- [`title`](#tecs.platform.window.HostState.title)
- [`visible`](#tecs.platform.window.HostState.visible)
- [`width`](#tecs.platform.window.HostState.width)
- [`x`](#tecs.platform.window.HostState.x)
- [`y`](#tecs.platform.window.HostState.y)
:::
::: api-item tecs.platform.window.HostState.constructor
#### `constructor` _constructor_
```nupp
function(
id: integer,
title: string,
width: integer,
height: integer,
pixelWidth: integer,
pixelHeight: integer,
scaleFactor: number,
x: integer,
y: integer,
focused: boolean,
visible: boolean,
minimized: boolean,
maximized: boolean,
fullscreen: boolean,
occluded: boolean,
resizable: boolean,
cursorVisible: boolean,
cursorGrab: CursorGrab
): tecs.platform.window.HostState
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`id` - `integer`
: Required.
`title` - `string`
: Required.
`width` - `integer`
: Required.
`height` - `integer`
: Required.
`pixelWidth` - `integer`
: Required.
`pixelHeight` - `integer`
: Required.
`scaleFactor` - `number`
: Required.
`x` - `integer`
: Required.
`y` - `integer`
: Required.
`focused` - `boolean`
: Required.
`visible` - `boolean`
: Required.
`minimized` - `boolean`
: Required.
`maximized` - `boolean`
: Required.
`fullscreen` - `boolean`
: Required.
`occluded` - `boolean`
: Required.
`resizable` - `boolean`
: Required.
`cursorVisible` - `boolean`
: Required.
`cursorGrab` - [`CursorGrab`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CursorGrab)
: Required.
##### Returns
[`tecs.platform.window.HostState`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.HostState)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").HostState(
id = id,
title = title,
width = width,
height = height,
pixelWidth = pixelWidth,
pixelHeight = pixelHeight,
scaleFactor = scaleFactor,
x = x,
y = y,
focused = focused,
visible = visible,
minimized = minimized,
maximized = maximized,
fullscreen = fullscreen,
occluded = occluded,
resizable = resizable,
cursorVisible = cursorVisible,
cursorGrab = cursorGrab
)
```
:::
::: api-item tecs.platform.window.HostState.id
#### `id` _field_
```nupp
id: integer
```
:::
::: api-item tecs.platform.window.HostState.title
#### `title` _field_
```nupp
title: string
```
:::
::: api-item tecs.platform.window.HostState.width
#### `width` _field_
```nupp
width: integer
```
:::
::: api-item tecs.platform.window.HostState.height
#### `height` _field_
```nupp
height: integer
```
:::
::: api-item tecs.platform.window.HostState.pixelWidth
#### `pixelWidth` _field_
```nupp
pixelWidth: integer
```
:::
::: api-item tecs.platform.window.HostState.pixelHeight
#### `pixelHeight` _field_
```nupp
pixelHeight: integer
```
:::
::: api-item tecs.platform.window.HostState.scaleFactor
#### `scaleFactor` _field_
```nupp
scaleFactor: number
```
:::
::: api-item tecs.platform.window.HostState.x
#### `x` _field_
```nupp
x: integer
```
:::
::: api-item tecs.platform.window.HostState.y
#### `y` _field_
```nupp
y: integer
```
:::
::: api-item tecs.platform.window.HostState.focused
#### `focused` _field_
```nupp
focused: boolean
```
:::
::: api-item tecs.platform.window.HostState.visible
#### `visible` _field_
```nupp
visible: boolean
```
:::
::: api-item tecs.platform.window.HostState.minimized
#### `minimized` _field_
```nupp
minimized: boolean
```
:::
::: api-item tecs.platform.window.HostState.maximized
#### `maximized` _field_
```nupp
maximized: boolean
```
:::
::: api-item tecs.platform.window.HostState.fullscreen
#### `fullscreen` _field_
```nupp
fullscreen: boolean
```
:::
::: api-item tecs.platform.window.HostState.occluded
#### `occluded` _field_
```nupp
occluded: boolean
```
:::
::: api-item tecs.platform.window.HostState.resizable
#### `resizable` _field_
```nupp
resizable: boolean
```
:::
::: api-item tecs.platform.window.HostState.cursorVisible
#### `cursorVisible` _field_
```nupp
cursorVisible: boolean
```
:::
::: api-item tecs.platform.window.HostState.cursorGrab
#### `cursorGrab` _field_
`cursorGrab:` [`CursorGrab`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CursorGrab)
:::
:::
::: api-item tecs.platform.window.Options
### `Options` _type_
```nupp
type Options = {
title: string?,
width: integer?,
height: integer?,
resizable: boolean?,
fullscreen: boolean?,
borderless: boolean?,
hidden: boolean?,
alwaysOnTop: boolean?,
transparent: boolean?,
x: integer?,
y: integer?,
minWidth: integer?,
minHeight: integer?,
maxWidth: integer?,
maxHeight: integer?
}
```
Optional settings copied when the application is constructed.
#### Members
::: api-overview
**fields**
- [`alwaysOnTop`](#tecs.platform.window.Options.alwaysOnTop)
- [`borderless`](#tecs.platform.window.Options.borderless)
- [`fullscreen`](#tecs.platform.window.Options.fullscreen)
- [`height`](#tecs.platform.window.Options.height)
- [`hidden`](#tecs.platform.window.Options.hidden)
- [`maxHeight`](#tecs.platform.window.Options.maxHeight)
- [`maxWidth`](#tecs.platform.window.Options.maxWidth)
- [`minHeight`](#tecs.platform.window.Options.minHeight)
- [`minWidth`](#tecs.platform.window.Options.minWidth)
- [`resizable`](#tecs.platform.window.Options.resizable)
- [`title`](#tecs.platform.window.Options.title)
- [`transparent`](#tecs.platform.window.Options.transparent)
- [`width`](#tecs.platform.window.Options.width)
- [`x`](#tecs.platform.window.Options.x)
- [`y`](#tecs.platform.window.Options.y)
:::
::: api-item tecs.platform.window.Options.title
#### `title` _field_
```nupp
title: string?
```
:::
::: api-item tecs.platform.window.Options.width
#### `width` _field_
```nupp
width: integer?
```
:::
::: api-item tecs.platform.window.Options.height
#### `height` _field_
```nupp
height: integer?
```
:::
::: api-item tecs.platform.window.Options.resizable
#### `resizable` _field_
```nupp
resizable: boolean?
```
:::
::: api-item tecs.platform.window.Options.fullscreen
#### `fullscreen` _field_
```nupp
fullscreen: boolean?
```
:::
::: api-item tecs.platform.window.Options.borderless
#### `borderless` _field_
```nupp
borderless: boolean?
```
:::
::: api-item tecs.platform.window.Options.hidden
#### `hidden` _field_
```nupp
hidden: boolean?
```
:::
::: api-item tecs.platform.window.Options.alwaysOnTop
#### `alwaysOnTop` _field_
```nupp
alwaysOnTop: boolean?
```
:::
::: api-item tecs.platform.window.Options.transparent
#### `transparent` _field_
```nupp
transparent: boolean?
```
:::
::: api-item tecs.platform.window.Options.x
#### `x` _field_
```nupp
x: integer?
```
:::
::: api-item tecs.platform.window.Options.y
#### `y` _field_
```nupp
y: integer?
```
:::
::: api-item tecs.platform.window.Options.minWidth
#### `minWidth` _field_
```nupp
minWidth: integer?
```
:::
::: api-item tecs.platform.window.Options.minHeight
#### `minHeight` _field_
```nupp
minHeight: integer?
```
:::
::: api-item tecs.platform.window.Options.maxWidth
#### `maxWidth` _field_
```nupp
maxWidth: integer?
```
:::
::: api-item tecs.platform.window.Options.maxHeight
#### `maxHeight` _field_
```nupp
maxHeight: integer?
```
:::
:::
::: api-item tecs.platform.window.RequestRedrawCommand
### `RequestRedrawCommand` _record_
```nupp
record RequestRedrawCommand
```
A request for a redraw callback on the next suitable host turn.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.RequestRedrawCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.RequestRedrawCommand.kind)
- [`serial`](#tecs.platform.window.RequestRedrawCommand.serial)
:::
::: api-item tecs.platform.window.RequestRedrawCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "requestRedraw",
serial: integer
): tecs.platform.window.RequestRedrawCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"requestRedraw"`
: Required.
`serial` - `integer`
: Required.
##### Returns
[`tecs.platform.window.RequestRedrawCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.RequestRedrawCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").RequestRedrawCommand(
kind = kind,
serial = serial
)
```
:::
::: api-item tecs.platform.window.RequestRedrawCommand.kind
#### `kind` _field_
```nupp
kind: "requestRedraw"
```
:::
::: api-item tecs.platform.window.RequestRedrawCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
:::
::: api-item tecs.platform.window.SetCursorGrabCommand
### `SetCursorGrabCommand` _record_
```nupp
record SetCursorGrabCommand
```
A request to change pointer confinement.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetCursorGrabCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.SetCursorGrabCommand.kind)
- [`mode`](#tecs.platform.window.SetCursorGrabCommand.mode)
- [`serial`](#tecs.platform.window.SetCursorGrabCommand.serial)
:::
::: api-item tecs.platform.window.SetCursorGrabCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setCursorGrab",
serial: integer,
mode: CursorGrab
): tecs.platform.window.SetCursorGrabCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setCursorGrab"`
: Required.
`serial` - `integer`
: Required.
`mode` - [`CursorGrab`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CursorGrab)
: Required.
##### Returns
[`tecs.platform.window.SetCursorGrabCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetCursorGrabCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetCursorGrabCommand(
kind = kind,
serial = serial,
mode = mode
)
```
:::
::: api-item tecs.platform.window.SetCursorGrabCommand.kind
#### `kind` _field_
```nupp
kind: "setCursorGrab"
```
:::
::: api-item tecs.platform.window.SetCursorGrabCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetCursorGrabCommand.mode
#### `mode` _field_
`mode:` [`CursorGrab`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CursorGrab)
:::
:::
::: api-item tecs.platform.window.SetCursorVisibleCommand
### `SetCursorVisibleCommand` _record_
```nupp
record SetCursorVisibleCommand
```
A request to show or hide the pointer.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetCursorVisibleCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.SetCursorVisibleCommand.kind)
- [`serial`](#tecs.platform.window.SetCursorVisibleCommand.serial)
- [`visible`](#tecs.platform.window.SetCursorVisibleCommand.visible)
:::
::: api-item tecs.platform.window.SetCursorVisibleCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setCursorVisible",
serial: integer,
visible: boolean
): tecs.platform.window.SetCursorVisibleCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setCursorVisible"`
: Required.
`serial` - `integer`
: Required.
`visible` - `boolean`
: Required.
##### Returns
[`tecs.platform.window.SetCursorVisibleCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetCursorVisibleCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetCursorVisibleCommand(
kind = kind,
serial = serial,
visible = visible
)
```
:::
::: api-item tecs.platform.window.SetCursorVisibleCommand.kind
#### `kind` _field_
```nupp
kind: "setCursorVisible"
```
:::
::: api-item tecs.platform.window.SetCursorVisibleCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetCursorVisibleCommand.visible
#### `visible` _field_
```nupp
visible: boolean
```
:::
:::
::: api-item tecs.platform.window.SetFullscreenCommand
### `SetFullscreenCommand` _record_
```nupp
record SetFullscreenCommand
```
A request to enter or leave borderless desktop fullscreen.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetFullscreenCommand.constructor)
**fields**
- [`fullscreen`](#tecs.platform.window.SetFullscreenCommand.fullscreen)
- [`kind`](#tecs.platform.window.SetFullscreenCommand.kind)
- [`serial`](#tecs.platform.window.SetFullscreenCommand.serial)
:::
::: api-item tecs.platform.window.SetFullscreenCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setFullscreen",
serial: integer,
fullscreen: boolean
): tecs.platform.window.SetFullscreenCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setFullscreen"`
: Required.
`serial` - `integer`
: Required.
`fullscreen` - `boolean`
: Required.
##### Returns
[`tecs.platform.window.SetFullscreenCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetFullscreenCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetFullscreenCommand(
kind = kind,
serial = serial,
fullscreen = fullscreen
)
```
:::
::: api-item tecs.platform.window.SetFullscreenCommand.kind
#### `kind` _field_
```nupp
kind: "setFullscreen"
```
:::
::: api-item tecs.platform.window.SetFullscreenCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetFullscreenCommand.fullscreen
#### `fullscreen` _field_
```nupp
fullscreen: boolean
```
:::
:::
::: api-item tecs.platform.window.SetPositionCommand
### `SetPositionCommand` _record_
```nupp
record SetPositionCommand
```
A request to move the top-left client position.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetPositionCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.SetPositionCommand.kind)
- [`serial`](#tecs.platform.window.SetPositionCommand.serial)
- [`x`](#tecs.platform.window.SetPositionCommand.x)
- [`y`](#tecs.platform.window.SetPositionCommand.y)
:::
::: api-item tecs.platform.window.SetPositionCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setPosition",
serial: integer,
x: integer,
y: integer
): tecs.platform.window.SetPositionCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setPosition"`
: Required.
`serial` - `integer`
: Required.
`x` - `integer`
: Required.
`y` - `integer`
: Required.
##### Returns
[`tecs.platform.window.SetPositionCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetPositionCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetPositionCommand(
kind = kind,
serial = serial,
x = x,
y = y
)
```
:::
::: api-item tecs.platform.window.SetPositionCommand.kind
#### `kind` _field_
```nupp
kind: "setPosition"
```
:::
::: api-item tecs.platform.window.SetPositionCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetPositionCommand.x
#### `x` _field_
```nupp
x: integer
```
:::
::: api-item tecs.platform.window.SetPositionCommand.y
#### `y` _field_
```nupp
y: integer
```
:::
:::
::: api-item tecs.platform.window.SetResizableCommand
### `SetResizableCommand` _record_
```nupp
record SetResizableCommand
```
A request to enable or disable edge resizing.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetResizableCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.SetResizableCommand.kind)
- [`resizable`](#tecs.platform.window.SetResizableCommand.resizable)
- [`serial`](#tecs.platform.window.SetResizableCommand.serial)
:::
::: api-item tecs.platform.window.SetResizableCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setResizable",
serial: integer,
resizable: boolean
): tecs.platform.window.SetResizableCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setResizable"`
: Required.
`serial` - `integer`
: Required.
`resizable` - `boolean`
: Required.
##### Returns
[`tecs.platform.window.SetResizableCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetResizableCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetResizableCommand(
kind = kind,
serial = serial,
resizable = resizable
)
```
:::
::: api-item tecs.platform.window.SetResizableCommand.kind
#### `kind` _field_
```nupp
kind: "setResizable"
```
:::
::: api-item tecs.platform.window.SetResizableCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetResizableCommand.resizable
#### `resizable` _field_
```nupp
resizable: boolean
```
:::
:::
::: api-item tecs.platform.window.SetSizeCommand
### `SetSizeCommand` _record_
```nupp
record SetSizeCommand
```
A request to change the logical client size.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetSizeCommand.constructor)
**fields**
- [`height`](#tecs.platform.window.SetSizeCommand.height)
- [`kind`](#tecs.platform.window.SetSizeCommand.kind)
- [`serial`](#tecs.platform.window.SetSizeCommand.serial)
- [`width`](#tecs.platform.window.SetSizeCommand.width)
:::
::: api-item tecs.platform.window.SetSizeCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setSize",
serial: integer,
width: integer,
height: integer
): tecs.platform.window.SetSizeCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setSize"`
: Required.
`serial` - `integer`
: Required.
`width` - `integer`
: Required.
`height` - `integer`
: Required.
##### Returns
[`tecs.platform.window.SetSizeCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetSizeCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetSizeCommand(
kind = kind,
serial = serial,
width = width,
height = height
)
```
:::
::: api-item tecs.platform.window.SetSizeCommand.kind
#### `kind` _field_
```nupp
kind: "setSize"
```
:::
::: api-item tecs.platform.window.SetSizeCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetSizeCommand.width
#### `width` _field_
```nupp
width: integer
```
:::
::: api-item tecs.platform.window.SetSizeCommand.height
#### `height` _field_
```nupp
height: integer
```
:::
:::
::: api-item tecs.platform.window.SetTitleCommand
### `SetTitleCommand` _record_
```nupp
record SetTitleCommand
```
A request to change the desktop title.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetTitleCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.SetTitleCommand.kind)
- [`serial`](#tecs.platform.window.SetTitleCommand.serial)
- [`title`](#tecs.platform.window.SetTitleCommand.title)
:::
::: api-item tecs.platform.window.SetTitleCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setTitle",
serial: integer,
title: string
): tecs.platform.window.SetTitleCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setTitle"`
: Required.
`serial` - `integer`
: Required.
`title` - `string`
: Required.
##### Returns
[`tecs.platform.window.SetTitleCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetTitleCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetTitleCommand(
kind = kind,
serial = serial,
title = title
)
```
:::
::: api-item tecs.platform.window.SetTitleCommand.kind
#### `kind` _field_
```nupp
kind: "setTitle"
```
:::
::: api-item tecs.platform.window.SetTitleCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetTitleCommand.title
#### `title` _field_
```nupp
title: string
```
:::
:::
::: api-item tecs.platform.window.SetVisibleCommand
### `SetVisibleCommand` _record_
```nupp
record SetVisibleCommand
```
A request to map or unmap the window.
#### Members
::: api-overview
**constructors**
- [`constructor`](#tecs.platform.window.SetVisibleCommand.constructor)
**fields**
- [`kind`](#tecs.platform.window.SetVisibleCommand.kind)
- [`serial`](#tecs.platform.window.SetVisibleCommand.serial)
- [`visible`](#tecs.platform.window.SetVisibleCommand.visible)
:::
::: api-item tecs.platform.window.SetVisibleCommand.constructor
#### `constructor` _constructor_
```nupp
function(
kind: "setVisible",
serial: integer,
visible: boolean
): tecs.platform.window.SetVisibleCommand
```
Constructs an instance from named fields. Optional fields may be omitted.
##### Arguments
`kind` - `"setVisible"`
: Required.
`serial` - `integer`
: Required.
`visible` - `boolean`
: Required.
##### Returns
[`tecs.platform.window.SetVisibleCommand`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.SetVisibleCommand)
: the constructed instance
##### Examples
Using values of the argument types above:
```nupp
local value = require("tecs.platform.window").SetVisibleCommand(
kind = kind,
serial = serial,
visible = visible
)
```
:::
::: api-item tecs.platform.window.SetVisibleCommand.kind
#### `kind` _field_
```nupp
kind: "setVisible"
```
:::
::: api-item tecs.platform.window.SetVisibleCommand.serial
#### `serial` _field_
```nupp
serial: integer
```
:::
::: api-item tecs.platform.window.SetVisibleCommand.visible
#### `visible` _field_
```nupp
visible: boolean
```
:::
:::
::: api-item tecs.platform.window.Window
### `Window` _record_
```nupp
record Window
```
The game-facing handle for one Rust-owned window.
#### Members
::: api-overview
**instance methods**
- [`creationOptions`](#tecs.platform.window.Window.creationOptions)
- [`cursorGrab`](#tecs.platform.window.Window.cursorGrab)
- [`getPixelSize`](#tecs.platform.window.Window.getPixelSize)
- [`getSize`](#tecs.platform.window.Window.getSize)
- [`hasFocus`](#tecs.platform.window.Window.hasFocus)
- [`id`](#tecs.platform.window.Window.id)
- [`isAttached`](#tecs.platform.window.Window.isAttached)
- [`isCursorVisible`](#tecs.platform.window.Window.isCursorVisible)
- [`isFullscreen`](#tecs.platform.window.Window.isFullscreen)
- [`isMaximized`](#tecs.platform.window.Window.isMaximized)
- [`isMinimized`](#tecs.platform.window.Window.isMinimized)
- [`isOccluded`](#tecs.platform.window.Window.isOccluded)
- [`isResizable`](#tecs.platform.window.Window.isResizable)
- [`isVisible`](#tecs.platform.window.Window.isVisible)
- [`position`](#tecs.platform.window.Window.position)
- [`requestRedraw`](#tecs.platform.window.Window.requestRedraw)
- [`scaleFactor`](#tecs.platform.window.Window.scaleFactor)
- [`setCursorGrab`](#tecs.platform.window.Window.setCursorGrab)
- [`setCursorVisible`](#tecs.platform.window.Window.setCursorVisible)
- [`setFullscreen`](#tecs.platform.window.Window.setFullscreen)
- [`setPosition`](#tecs.platform.window.Window.setPosition)
- [`setResizable`](#tecs.platform.window.Window.setResizable)
- [`setSize`](#tecs.platform.window.Window.setSize)
- [`setTitle`](#tecs.platform.window.Window.setTitle)
- [`setVisible`](#tecs.platform.window.Window.setVisible)
- [`title`](#tecs.platform.window.Window.title)
:::
::: api-item tecs.platform.window.Window.creationOptions
#### `creationOptions` _method_
```nupp
function(borrows self: Window): CreateOptions
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
[`CreateOptions`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CreateOptions)
:
:::
::: api-item tecs.platform.window.Window.isAttached
#### `isAttached` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.id
#### `id` _method_
```nupp
function(borrows self: Window): integer
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.title
#### `title` _method_
```nupp
function(borrows self: Window): string
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`string`
:
:::
::: api-item tecs.platform.window.Window.getSize
#### `getSize` _method_
```nupp
function(borrows self: Window): (integer, integer)
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`integer`
:
`integer`
:
:::
::: api-item tecs.platform.window.Window.getPixelSize
#### `getPixelSize` _method_
```nupp
function(borrows self: Window): (integer, integer)
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`integer`
:
`integer`
:
:::
::: api-item tecs.platform.window.Window.scaleFactor
#### `scaleFactor` _method_
```nupp
function(borrows self: Window): number
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`number`
:
:::
::: api-item tecs.platform.window.Window.position
#### `position` _method_
```nupp
function(borrows self: Window): (integer, integer)
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`integer`
:
`integer`
:
:::
::: api-item tecs.platform.window.Window.hasFocus
#### `hasFocus` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isVisible
#### `isVisible` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isMinimized
#### `isMinimized` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isMaximized
#### `isMaximized` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isFullscreen
#### `isFullscreen` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isOccluded
#### `isOccluded` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isResizable
#### `isResizable` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.isCursorVisible
#### `isCursorVisible` _method_
```nupp
function(borrows self: Window): boolean
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`boolean`
:
:::
::: api-item tecs.platform.window.Window.cursorGrab
#### `cursorGrab` _method_
```nupp
function(borrows self: Window): CursorGrab
```
##### Arguments
`borrows self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
[`CursorGrab`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CursorGrab)
:
:::
::: api-item tecs.platform.window.Window.setTitle
#### `setTitle` _method_
```nupp
function(exclusive self: Window, title: string): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`title` - `string`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setSize
#### `setSize` _method_
```nupp
function(exclusive self: Window, width: integer, height: integer): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`width` - `integer`
:
`height` - `integer`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setPosition
#### `setPosition` _method_
```nupp
function(exclusive self: Window, x: integer, y: integer): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`x` - `integer`
:
`y` - `integer`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setVisible
#### `setVisible` _method_
```nupp
function(exclusive self: Window, visible: boolean): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`visible` - `boolean`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setResizable
#### `setResizable` _method_
```nupp
function(exclusive self: Window, resizable: boolean): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`resizable` - `boolean`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setFullscreen
#### `setFullscreen` _method_
```nupp
function(exclusive self: Window, fullscreen: boolean): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`fullscreen` - `boolean`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setCursorVisible
#### `setCursorVisible` _method_
```nupp
function(exclusive self: Window, visible: boolean): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`visible` - `boolean`
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.setCursorGrab
#### `setCursorGrab` _method_
```nupp
function(exclusive self: Window, mode: CursorGrab): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
`mode` - [`CursorGrab`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.CursorGrab)
:
##### Returns
`integer`
:
:::
::: api-item tecs.platform.window.Window.requestRedraw
#### `requestRedraw` _method_
```nupp
function(exclusive self: Window): integer
```
##### Arguments
`exclusive self` - [`Window`](../../../../modules/tecs/platform/window/index.html#tecs.platform.window.Window)
:
##### Returns
`integer`
:
:::
:::
:::