# tecs.platform.window ## Windows `tecs.platform.window` creates OS windows and reads the displays around them. [`Application`](/modules/Application/) creates the usual game window as `app.window`. Tools and tests that call `newWindow` directly must call `destroy` when they finish. ```teal local window = tecs.platform.window.newWindow({ title = "Starfarer", width = 1600, height = 900, hidden = true, }) window:center() window:show() ``` ### Screen coordinates and pixels Window layout and pointer input use screen coordinates. Render targets use pixels. A high-density display may put several pixels behind one screen coordinate. ```teal local width , height = window:getSize() local pixelWidth , pixelHeight = window:getPixelSize() local density = window:pixelDensity() assert(pixelWidth == width * density) assert(pixelHeight == height * density) ``` `displayScale` reports the desktop's preferred scale for text and interface metrics. It does not convert between the two sizes. ### Compositor changes Size, position and fullscreen setters may return before the compositor applies the request. Most games consume the corresponding event later. Call `sync` only before an immediate readback. ```teal window:setSize(1280, 720) if window:sync() then local width , height = window:getSize() end ``` ### Fullscreen modes Fullscreen uses the desktop resolution when the caller selects no mode. Exclusive fullscreen accepts only a mode that `fullscreenModes` or `closestFullscreenMode` returns. ```teal local mode = tecs.platform.window.Window.closestFullscreenMode( savedWidth, savedHeight, savedRefreshRate, true ) if mode ~= nil then window:setFullscreenMode(mode) window:setFullscreen(true) end ``` ### Display placement Desktop positions span every attached display and may contain negative coordinates. Use usable bounds to keep windows clear of a taskbar, dock or menu bar. ```teal for _, displayId in ipairs(tecs.platform.window.Window.displays()) do local x , y , width , height = tecs.platform.window.Window.usableBounds( displayId ) end ``` Display and window events report changes. Getters report current state, including state that existed before the first event. Use `Window:id` to match a window event's `which` field. ### Custom window chrome A borderless window can return selected regions to the desktop for dragging and edge resizing. `setHitRegions` copies the complete list, so UI layout may reuse or change its records as soon as the call returns. The first region that contains a point wins. ```teal window:setHitRegions({ {kind = "draggable", x = 0, y = 0, width = 800, height = 40}, {kind = "resizeBottom", x = 0, y = 596, width = 800, height = 4}, }) ``` Hit testing runs inside the native window manager callback. Rust reads the copied regions there; SDL never calls a Lua function. ### Pointer ownership The window API owns mouse and keyboard confinement. `tecs.input` owns relative mouse mode, warping, capture and cursor visibility. The GPU device owns presentation pacing after it claims a window. ## Module contents ### Constructors | Constructor | Description | | --- | --- | | [`newWindow`](/modules/platform/window/#tecs.platform.window.newWindow) | Opens a window and raises when it cannot create a usable one. | ### Types | Type | Kind | Description | | --- | --- | --- | | [`DisplayMode`](/modules/platform/window/#tecs.platform.window.DisplayMode) | type | Describes one fullscreen mode a display offers. | | [`Flash`](/modules/platform/window/#tecs.platform.window.Flash) | type | Selects how a window asks for attention. | | [`HitRegion`](/modules/platform/window/#tecs.platform.window.HitRegion) | type | Describes one custom window region. | | [`HitRegionKind`](/modules/platform/window/#tecs.platform.window.HitRegionKind) | type | Selects how the desktop treats a custom window region. | | [`Options`](/modules/platform/window/#tecs.platform.window.Options) | type | Describes the caller-writable configuration that newWindow reads. | | [`Orientation`](/modules/platform/window/#tecs.platform.window.Orientation) | type | Describes which way up a display is. | | [`Progress`](/modules/platform/window/#tecs.platform.window.Progress) | type | Selects what a taskbar progress indicator shows. | | [`Theme`](/modules/platform/window/#tecs.platform.window.Theme) | type | Describes the desktop's light or dark preference. | | [`Window`](/modules/platform/window/#tecs.platform.window.Window) | record | A Window owns one open OS window and reads the displays around it. | ## Constructors ### tecs.platform.window.newWindow Static Opens a window and raises when it cannot create a usable one. It validates sizes and the icon before returning. Omitted fields take the defaults that [`Options`](/modules/platform/window/#tecs.platform.window.Window.Options) documents. ```teal function tecs.platform.window.newWindow(options: Window.Options): Window ``` #### Arguments | Name | Type | Description | | --- | --- | --- | | `options` | [`Window.Options`](/modules/platform/window/#tecs.platform.window.Window.Options) | The caller supplies the initial window configuration. | #### Returns | Type | Description | | --- | --- | | [`Window`](/modules/platform/window/#tecs.platform.window.Window) | Returns the caller-owned window. The caller releases it through `destroy`. | ## Types ### tecs.platform.window.DisplayMode type Describes one fullscreen mode a display offers. ```teal type tecs.platform.window.DisplayMode = Window.DisplayMode ``` ### tecs.platform.window.Flash type Selects how a window asks for attention. ```teal type tecs.platform.window.Flash = Window.Flash ``` ### tecs.platform.window.HitRegion type Describes one custom window region. ```teal type tecs.platform.window.HitRegion = Window.HitRegion ``` ### tecs.platform.window.HitRegionKind type Selects how the desktop treats a custom window region. ```teal type tecs.platform.window.HitRegionKind = Window.HitRegionKind ``` ### tecs.platform.window.Options type Describes the caller-writable configuration that `newWindow` reads. ```teal type tecs.platform.window.Options = Window.Options ``` ### tecs.platform.window.Orientation type Describes which way up a display is. ```teal type tecs.platform.window.Orientation = Window.Orientation ``` ### tecs.platform.window.Progress type Selects what a taskbar progress indicator shows. ```teal type tecs.platform.window.Progress = Window.Progress ``` ### tecs.platform.window.Theme type Describes the desktop's light or dark preference. ```teal type tecs.platform.window.Theme = Window.Theme ``` ### tecs.platform.window.Window record A `Window` owns one open OS window and reads the displays around it. Game code changes state through methods. Public fields expose framework state and remain read-only to callers. ```teal record tecs.platform.window.Window handle: loader.CPtr title: string enum Orientation "landscape" "landscapeFlipped" "portrait" "portraitFlipped" "unknown" end enum Theme "dark" "light" "unknown" end enum Flash "brief" "cancel" "untilFocused" end enum Progress "error" "indeterminate" "none" "normal" "paused" end enum HitRegionKind "draggable" "resizeBottom" "resizeBottomLeft" "resizeBottomRight" "resizeLeft" "resizeRight" "resizeTop" "resizeTopLeft" "resizeTopRight" end record HitRegion kind: HitRegionKind x: integer y: integer width: integer height: integer end record DisplayMode display: integer width: integer height: integer pixelDensity: number refreshRate: number end record Options title: string width: integer height: integer resizable: boolean highPixelDensity: boolean fullscreen: boolean borderless: boolean hidden: boolean alwaysOnTop: boolean transparent: boolean x: integer y: integer minWidth: integer minHeight: integer maxWidth: integer maxHeight: integer icon: string end closestFullscreenMode: function( width: integer, height: integer, refreshRate: number, highDensity: boolean, displayId: integer ): Window.DisplayMode contentScale: function(displayId: integer): number currentMode: function(displayId: integer): Window.DisplayMode desktopMode: function(displayId: integer): Window.DisplayMode displayBounds: function( displayId: integer ): integer, integer, integer, integer displayName: function(displayId: integer): string displays: function(): {integer} fullscreenModes: function(displayId: integer): {Window.DisplayMode} isSupported: function(): boolean naturalOrientation: function(displayId: integer): Window.Orientation orientation: function(displayId: integer): Window.Orientation primaryDisplay: function(): integer screenSaverEnabled: function(): boolean setScreenSaverEnabled: function(enabled: boolean): boolean theme: function(): Window.Theme usableBounds: function( displayId: integer ): integer, integer, integer, integer aspectRatio: function(self): number, number borderSize: function(self): integer, integer, integer, integer center: function(self, displayId: integer): boolean destroy: function(self) display: function(self): integer displayScale: function(self): number flash: function(self, operation: Window.Flash): boolean fullscreenMode: function(self): Window.DisplayMode getPixelSize: function(self): integer, integer getSize: function(self): integer, integer hasFocus: function(self): boolean hasMouseFocus: function(self): boolean hide: function(self): boolean id: function(self): integer isAlwaysOnTop: function(self): boolean isBordered: function(self): boolean isFocusable: function(self): boolean isFullscreen: function(self): boolean isMaximized: function(self): boolean isMinimized: function(self): boolean isOccluded: function(self): boolean isResizable: function(self): boolean isVisible: function(self): boolean keyboardGrab: function(self): boolean maximize: function(self): boolean maximumSize: function(self): integer, integer minimize: function(self): boolean minimumSize: function(self): integer, integer mouseGrab: function(self): boolean mouseRect: function(self): integer, integer, integer, integer opacity: function(self): number pixelDensity: function(self): number position: function(self): integer, integer progress: function(self): Window.Progress, number raise: function(self): boolean restore: function(self): boolean safeArea: function(self): integer, integer, integer, integer setAlwaysOnTop: function(self, onTop: boolean): boolean setAspectRatio: function( self, minimum: number, maximum: number ): boolean setBordered: function(self, bordered: boolean): boolean setFocusable: function(self, focusable: boolean): boolean setFullscreen: function(self, fullscreen: boolean): boolean setFullscreenMode: function(self, mode: Window.DisplayMode): boolean setHitRegions: function(self, regions: {Window.HitRegion}): boolean setIcon: function(self, path: string): boolean setKeyboardGrab: function(self, grabbed: boolean): boolean setMaximumSize: function( self, width: integer, height: integer ): boolean setMinimumSize: function( self, width: integer, height: integer ): boolean setMouseGrab: function(self, grabbed: boolean): boolean setMouseRect: function( self, x: integer, y: integer, width: integer, height: integer ): boolean setOpacity: function(self, opacity: number): boolean setPosition: function(self, x: integer, y: integer): boolean setProgress: function( self, state: Window.Progress, value: number ): boolean setResizable: function(self, resizable: boolean): boolean setSize: function(self, width: integer, height: integer): boolean setTitle: function(self, title: string): boolean show: function(self): boolean showSystemMenu: function(self, x: integer, y: integer): boolean sync: function(self): boolean end ``` #### tecs.platform.window.Window.handle field Engine-owned. The framework stores the native window handle here for the GPU device to claim for presentation and sets it to nil when `destroy` runs. Ordinary game code ignores this field. ```teal tecs.platform.window.Window.handle: loader.CPtr ``` #### tecs.platform.window.Window.title field Read-only. The framework stores the last title here when it creates the window or `setTitle` succeeds. Game code changes it through `setTitle`. ```teal tecs.platform.window.Window.title: string ``` #### tecs.platform.window.Window.Orientation enum `Orientation` describes a display's current or natural rotation. ```teal enum tecs.platform.window.Window.Orientation "landscape" "landscapeFlipped" "portrait" "portraitFlipped" "unknown" end ``` #### tecs.platform.window.Window.Theme enum `Theme` describes the desktop's requested appearance. ```teal enum tecs.platform.window.Window.Theme "dark" "light" "unknown" end ``` #### tecs.platform.window.Window.Flash enum `Flash` selects how long the desktop asks for attention. ```teal enum tecs.platform.window.Window.Flash "brief" "cancel" "untilFocused" end ``` #### tecs.platform.window.Window.Progress enum `Progress` selects what the taskbar or dock shows over the icon. ```teal enum tecs.platform.window.Window.Progress "error" "indeterminate" "none" "normal" "paused" end ``` #### tecs.platform.window.Window.HitRegionKind enum `HitRegionKind` selects how the desktop treats a window region. ```teal enum tecs.platform.window.Window.HitRegionKind "draggable" "resizeBottom" "resizeBottomLeft" "resizeBottomRight" "resizeLeft" "resizeRight" "resizeTop" "resizeTopLeft" "resizeTopRight" end ``` #### tecs.platform.window.Window.HitRegion record `HitRegion` gives part of a borderless window desktop behavior. ```teal record tecs.platform.window.Window.HitRegion kind: HitRegionKind x: integer y: integer width: integer height: integer end ``` ##### tecs.platform.window.Window.HitRegion.kind field Caller-writable. Selects dragging or one resize direction. ```teal tecs.platform.window.Window.HitRegion.kind: HitRegionKind ``` ##### tecs.platform.window.Window.HitRegion.x field Caller-writable. Sets the left edge in window client coordinates. It must be a non-negative integer. ```teal tecs.platform.window.Window.HitRegion.x: integer ``` ##### tecs.platform.window.Window.HitRegion.y field Caller-writable. Sets the top edge in window client coordinates. It must be a non-negative integer. ```teal tecs.platform.window.Window.HitRegion.y: integer ``` ##### tecs.platform.window.Window.HitRegion.width field Caller-writable. Sets a positive width in window client coordinates. ```teal tecs.platform.window.Window.HitRegion.width: integer ``` ##### tecs.platform.window.Window.HitRegion.height field Caller-writable. Sets a positive height in window client coordinates. ```teal tecs.platform.window.Window.HitRegion.height: integer ``` #### tecs.platform.window.Window.DisplayMode record `DisplayMode` describes one video mode returned by the platform. Callers treat every field as read-only and pass the record back to `setFullscreenMode`. ```teal record tecs.platform.window.Window.DisplayMode display: integer width: integer height: integer pixelDensity: number refreshRate: number end ``` ##### tecs.platform.window.Window.DisplayMode.display field Read-only. The platform sets `display` when it builds the mode. ```teal tecs.platform.window.Window.DisplayMode.display: integer ``` ##### tecs.platform.window.Window.DisplayMode.width field Read-only. The platform sets `width` in screen coordinates when it builds the mode. Callers multiply it by `pixelDensity` to obtain pixels. ```teal tecs.platform.window.Window.DisplayMode.width: integer ``` ##### tecs.platform.window.Window.DisplayMode.height field Read-only. The platform sets `height` in screen coordinates when it builds the mode. Callers multiply it by `pixelDensity` to obtain pixels. ```teal tecs.platform.window.Window.DisplayMode.height: integer ``` ##### tecs.platform.window.Window.DisplayMode.pixelDensity field Read-only. The platform sets `pixelDensity` when it builds the mode. A 1920 by 1080 mode at 2.0 draws 3840 by 2160 pixels. ```teal tecs.platform.window.Window.DisplayMode.pixelDensity: number ``` ##### tecs.platform.window.Window.DisplayMode.refreshRate field Read-only. The platform sets `refreshRate` in hertz when it builds the mode, or to zero when it cannot report a rate. ```teal tecs.platform.window.Window.DisplayMode.refreshRate: number ``` #### tecs.platform.window.Window.Options record Callers may set any `Options` field before passing the record to `newWindow`. The function reads the values and does not retain the record. ```teal record tecs.platform.window.Window.Options title: string width: integer height: integer resizable: boolean highPixelDensity: boolean fullscreen: boolean borderless: boolean hidden: boolean alwaysOnTop: boolean transparent: boolean x: integer y: integer minWidth: integer minHeight: integer maxWidth: integer maxHeight: integer icon: string end ``` ##### tecs.platform.window.Window.Options.title field Caller-writable. The caller sets `title` to the desktop title before `newWindow` reads it. It defaults to `"tecs"`. ```teal tecs.platform.window.Window.Options.title: string ``` ##### tecs.platform.window.Window.Options.width field Caller-writable. The caller sets `width` in screen coordinates before `newWindow` reads it. It defaults to 1280. ```teal tecs.platform.window.Window.Options.width: integer ``` ##### tecs.platform.window.Window.Options.height field Caller-writable. The caller sets `height` in screen coordinates before `newWindow` reads it. It defaults to 720. ```teal tecs.platform.window.Window.Options.height: integer ``` ##### tecs.platform.window.Window.Options.resizable field Caller-writable. The caller sets `resizable` before `newWindow` reads it. It defaults to true, and only false disables edge resizing. ```teal tecs.platform.window.Window.Options.resizable: boolean ``` ##### tecs.platform.window.Window.Options.highPixelDensity field Caller-writable. The caller sets `highPixelDensity` before `newWindow` reads it. It defaults to true and lets the drawable follow the display density instead of stretching. ```teal tecs.platform.window.Window.Options.highPixelDensity: boolean ``` ##### tecs.platform.window.Window.Options.fullscreen field Caller-writable. The caller sets `fullscreen` before `newWindow` reads it to start on the display selected by the window manager. It defaults to false. ```teal tecs.platform.window.Window.Options.fullscreen: boolean ``` ##### tecs.platform.window.Window.Options.borderless field Caller-writable. The caller sets `borderless` before `newWindow` reads it to remove the title bar and frame. It defaults to false. ```teal tecs.platform.window.Window.Options.borderless: boolean ``` ##### tecs.platform.window.Window.Options.hidden field Caller-writable. The caller sets `hidden` before `newWindow` reads it to defer mapping until `show`. It defaults to false. ```teal tecs.platform.window.Window.Options.hidden: boolean ``` ##### tecs.platform.window.Window.Options.alwaysOnTop field Caller-writable. The caller sets `alwaysOnTop` before `newWindow` reads it to keep the window above others. It defaults to false. ```teal tecs.platform.window.Window.Options.alwaysOnTop: boolean ``` ##### tecs.platform.window.Window.Options.transparent field Caller-writable. The caller sets `transparent` before `newWindow` reads it to request desktop alpha compositing. It defaults to false. ```teal tecs.platform.window.Window.Options.transparent: boolean ``` ##### tecs.platform.window.Window.Options.x field Caller-writable. The caller sets `x` with `y` before `newWindow` reads them. Without both fields, the window manager chooses the position. ```teal tecs.platform.window.Window.Options.x: integer ``` ##### tecs.platform.window.Window.Options.y field Caller-writable. The caller sets `y` with `x` before `newWindow` reads them. ```teal tecs.platform.window.Window.Options.y: integer ``` ##### tecs.platform.window.Window.Options.minWidth field Caller-writable. The caller sets `minWidth` with `minHeight` before `newWindow` reads them. ```teal tecs.platform.window.Window.Options.minWidth: integer ``` ##### tecs.platform.window.Window.Options.minHeight field Caller-writable. The caller sets `minHeight` with `minWidth` before `newWindow` reads them. ```teal tecs.platform.window.Window.Options.minHeight: integer ``` ##### tecs.platform.window.Window.Options.maxWidth field Caller-writable. The caller sets `maxWidth` with `maxHeight` before `newWindow` reads them. ```teal tecs.platform.window.Window.Options.maxWidth: integer ``` ##### tecs.platform.window.Window.Options.maxHeight field Caller-writable. The caller sets `maxHeight` with `maxWidth` before `newWindow` reads them. ```teal tecs.platform.window.Window.Options.maxHeight: integer ``` ##### tecs.platform.window.Window.Options.icon field Caller-writable. The caller sets `icon` to an image path before `newWindow` reads it. `newWindow` decodes it synchronously. ```teal tecs.platform.window.Window.Options.icon: string ``` #### tecs.platform.window.Window.closestFullscreenMode Static Finds the nearest fullscreen mode to a requested size. Use this when restoring a saved mode that the display may no longer offer exactly. ```teal function tecs.platform.window.Window.closestFullscreenMode( width: integer, height: integer, refreshRate: number, highDensity: boolean, displayId: integer ): Window.DisplayMode ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `width` | `integer` | The caller supplies the requested width in screen coordinates. | | `height` | `integer` | The caller supplies the requested height in screen coordinates. | | `refreshRate` | `number` | The caller supplies hertz, or zero or nil for the highest available rate. | | `highDensity` | `boolean` | The caller chooses whether the function may select modes above density 1. It defaults to false. | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the nearest platform mode, or nil when none fits. | #### tecs.platform.window.Window.contentScale Static Reads a display's preferred content scale. ```teal function tecs.platform.window.Window.contentScale( displayId: integer ): number ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | `number` | Returns the scale, or zero without video. | #### tecs.platform.window.Window.currentMode Static Reads the display mode in use now. ```teal function tecs.platform.window.Window.currentMode( displayId: integer ): Window.DisplayMode ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the mode, or nil without video. | #### tecs.platform.window.Window.desktopMode Static Reads the display mode the desktop started in. ```teal function tecs.platform.window.Window.desktopMode( displayId: integer ): Window.DisplayMode ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the mode, or nil without video. | #### tecs.platform.window.Window.displayBounds Static Reads a display's desktop rectangle. ```teal function tecs.platform.window.Window.displayBounds( displayId: integer ): integer, integer, integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the horizontal position in desktop screen coordinates. | | `integer` | Returns the vertical position in desktop screen coordinates. | | `integer` | Returns the width in screen coordinates. | | `integer` | Returns the height in screen coordinates. | #### tecs.platform.window.Window.displayName Static Reads the desktop name for a display. ```teal function tecs.platform.window.Window.displayName( displayId: integer ): string ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | `string` | Returns the name, or an empty string without video. | #### tecs.platform.window.Window.displays Static Lists attached displays in platform order. ```teal function tecs.platform.window.Window.displays(): {integer} ``` ##### Arguments None. ##### Returns | Type | Description | | --- | --- | | `{integer}` | Returns display ids, or an empty list without video. | #### tecs.platform.window.Window.fullscreenModes Static Lists the display's exclusive fullscreen modes, largest first. ```teal function tecs.platform.window.Window.fullscreenModes( displayId: integer ): {Window.DisplayMode} ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | `{`[`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode)`}` | Returns modes accepted by `setFullscreenMode`, or an empty list without video. | #### tecs.platform.window.Window.isSupported Static Returns whether the platform can create and inspect windows. False in a headless process. Display and screen-saver functions answer harmless defaults there, while `newWindow` raises. ```teal function tecs.platform.window.Window.isSupported(): boolean ``` ##### Arguments None. ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns true when this process can create and inspect windows. | #### tecs.platform.window.Window.naturalOrientation Static Reads the orientation a display was built for. ```teal function tecs.platform.window.Window.naturalOrientation( displayId: integer ): Window.Orientation ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | [`Window.Orientation`](/modules/platform/window/#tecs.platform.window.Window.Orientation) | Returns the natural orientation, or `"unknown"` without video. | #### tecs.platform.window.Window.orientation Static Reads a display's current rotation. ```teal function tecs.platform.window.Window.orientation( displayId: integer ): Window.Orientation ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | [`Window.Orientation`](/modules/platform/window/#tecs.platform.window.Window.Orientation) | Returns the orientation, or `"unknown"` without video. | #### tecs.platform.window.Window.primaryDisplay Static Reads the desktop's primary display. ```teal function tecs.platform.window.Window.primaryDisplay(): integer ``` ##### Arguments None. ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the display id, or zero without video. | #### tecs.platform.window.Window.screenSaverEnabled Static Returns whether the desktop may blank the display. Video startup disables the screen saver. Enable it for an unattended menu or cutscene. ```teal function tecs.platform.window.Window.screenSaverEnabled(): boolean ``` ##### Arguments None. ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false without video. | #### tecs.platform.window.Window.setScreenSaverEnabled Static Allows or forbids the desktop blanking the display. ```teal function tecs.platform.window.Window.setScreenSaverEnabled( enabled: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `enabled` | `boolean` | The caller chooses whether the screen saver may run. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the change, or false without video. | #### tecs.platform.window.Window.theme Static Reads the desktop's light or dark preference. ```teal function tecs.platform.window.Window.theme(): Window.Theme ``` ##### Arguments None. ##### Returns | Type | Description | | --- | --- | | [`Window.Theme`](/modules/platform/window/#tecs.platform.window.Window.Theme) | Returns `"light"`, `"dark"` or `"unknown"`. | #### tecs.platform.window.Window.usableBounds Static Reads the display area not occupied by desktop chrome. ```teal function tecs.platform.window.Window.usableBounds( displayId: integer ): integer, integer, integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `displayId` | `integer` | The caller omits this value to use the primary display. | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the horizontal position in desktop screen coordinates. | | `integer` | Returns the vertical position in desktop screen coordinates. | | `integer` | Returns the width in screen coordinates. | | `integer` | Returns the height in screen coordinates. | #### tecs.platform.window.Window:aspectRatio Instance Reads the allowed width-over-height range. ```teal function tecs.platform.window.Window.aspectRatio(self): number, number ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `number` | Returns the minimum ratio, or zero when unset. | | `number` | Returns the maximum ratio, or zero when unset. | #### tecs.platform.window.Window:borderSize Instance Reads the window decoration thickness in screen coordinates. ```teal function tecs.platform.window.Window.borderSize( self ): integer, integer, integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the top thickness, or zero without decoration. | | `integer` | Returns the left thickness, or zero without decoration. | | `integer` | Returns the bottom thickness, or zero without decoration. | | `integer` | Returns the right thickness, or zero without decoration. | #### tecs.platform.window.Window:center Instance Centers the window on a display. ```teal function tecs.platform.window.Window.center( self, displayId: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `displayId` | `integer` | The caller omits this value to use the display the window occupies. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:destroy Instance Releases the window. Safe to call more than once. Every getter answers zero, false or nil after this call. ```teal function tecs.platform.window.Window.destroy(self) ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns None. #### tecs.platform.window.Window:display Instance Reads the display this window mostly occupies. ```teal function tecs.platform.window.Window.display(self): integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the display id, or zero after `destroy`. | #### tecs.platform.window.Window:displayScale Instance Returns the desktop's preferred scale for content. This is not the ratio between `getSize` and `getPixelSize`; use `pixelDensity` for that. A theme or UI can multiply its natural metrics by this value. ```teal function tecs.platform.window.Window.displayScale(self): number ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `number` | Returns the scale, or zero after `destroy`. | #### tecs.platform.window.Window:flash Instance Asks for attention without taking focus. `"untilFocused"` keeps asking and `"cancel"` stops a request. An unknown operation raises. ```teal function tecs.platform.window.Window.flash( self, operation: Window.Flash ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `operation` | [`Window.Flash`](/modules/platform/window/#tecs.platform.window.Window.Flash) | The caller chooses how long to ask for attention. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the desktop accepted the request. | #### tecs.platform.window.Window:fullscreenMode Instance Reads the selected exclusive fullscreen mode. ```teal function tecs.platform.window.Window.fullscreenMode( self ): Window.DisplayMode ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the mode, or nil for borderless fullscreen and after `destroy`. | #### tecs.platform.window.Window:getPixelSize Instance Reads the drawable size in pixels. ```teal function tecs.platform.window.Window.getPixelSize( self ): integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the pixel width, or zero after `destroy`. | | `integer` | Returns the pixel height, or zero after `destroy`. | #### tecs.platform.window.Window:getSize Instance Reads the window size in screen coordinates. Pointer positions use these units. Render targets use `getPixelSize`. ```teal function tecs.platform.window.Window.getSize(self): integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the width, or zero after `destroy`. | | `integer` | Returns the height, or zero after `destroy`. | #### tecs.platform.window.Window:hasFocus Instance Returns whether keyboard events currently target this window. ```teal function tecs.platform.window.Window.hasFocus(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:hasMouseFocus Instance Returns whether the pointer is over the window. Relative mouse mode has no pointer position and reports false. ```teal function tecs.platform.window.Window.hasMouseFocus(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:hide Instance Unmaps the window without destroying it. A claimed swapchain yields no texture while the desktop hides the window. ```teal function tecs.platform.window.Window.hide(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform hid the window. | #### tecs.platform.window.Window:id Instance Returns the id carried in a window event's `which` field. ```teal function tecs.platform.window.Window.id(self): integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the platform window id, or zero after `destroy`. | #### tecs.platform.window.Window:isAlwaysOnTop Instance Returns whether the desktop keeps the window above others. ```teal function tecs.platform.window.Window.isAlwaysOnTop(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isBordered Instance Returns whether the window has a title bar and frame. ```teal function tecs.platform.window.Window.isBordered(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isFocusable Instance Returns whether the window may take keyboard focus. ```teal function tecs.platform.window.Window.isFocusable(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isFullscreen Instance Returns whether the window occupies a fullscreen display. ```teal function tecs.platform.window.Window.isFullscreen(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isMaximized Instance Returns whether the window fills the display's usable bounds. ```teal function tecs.platform.window.Window.isMaximized(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isMinimized Instance Returns whether the window occupies its minimized state. ```teal function tecs.platform.window.Window.isMinimized(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isOccluded Instance Returns whether other windows cover this window completely. ```teal function tecs.platform.window.Window.isOccluded(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isResizable Instance Returns whether the user can resize the window by dragging an edge. ```teal function tecs.platform.window.Window.isResizable(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:isVisible Instance Returns whether the desktop shows the window. Minimizing the window does not hide it. ```teal function tecs.platform.window.Window.isVisible(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false for a hidden or destroyed window. | #### tecs.platform.window.Window:keyboardGrab Instance Returns whether the window intercepts desktop keyboard shortcuts. ```teal function tecs.platform.window.Window.keyboardGrab(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false after `destroy`. | #### tecs.platform.window.Window:maximize Instance Maximizes the window to the display's usable bounds. ```teal function tecs.platform.window.Window.maximize(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:maximumSize Instance Reads the maximum resize limit. ```teal function tecs.platform.window.Window.maximumSize(self): integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the maximum width, or zero when unset. | | `integer` | Returns the maximum height, or zero when unset. | #### tecs.platform.window.Window:minimize Instance Minimizes the window to the taskbar or dock. ```teal function tecs.platform.window.Window.minimize(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:minimumSize Instance Reads the minimum resize limit. ```teal function tecs.platform.window.Window.minimumSize(self): integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the minimum width, or zero when unset. | | `integer` | Returns the minimum height, or zero when unset. | #### tecs.platform.window.Window:mouseGrab Instance Returns whether pointer confinement applies to the focused window. ```teal function tecs.platform.window.Window.mouseGrab(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false when the window lacks focus or after `destroy`. | #### tecs.platform.window.Window:mouseRect Instance Reads the pointer confinement region. ```teal function tecs.platform.window.Window.mouseRect( self ): integer, integer, integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the horizontal offset in screen coordinates. | | `integer` | Returns the vertical offset in screen coordinates. | | `integer` | Returns the width in screen coordinates. | | `integer` | Returns the height in screen coordinates. All four values contain zero when unset. | #### tecs.platform.window.Window:opacity Instance Reads the window opacity. ```teal function tecs.platform.window.Window.opacity(self): number ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `number` | Returns a value from 0 for invisible to 1 for solid, zero after `destroy`, or 1 on a platform without compositing. | #### tecs.platform.window.Window:pixelDensity Instance Returns the ratio of drawable pixels to screen coordinates. ```teal function tecs.platform.window.Window.pixelDensity(self): number ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `number` | Returns the ratio, 1 without high-density drawing, or zero after `destroy`. | #### tecs.platform.window.Window:position Instance Reads the top-left corner in desktop screen coordinates. ```teal function tecs.platform.window.Window.position(self): integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the horizontal position, or zero after `destroy`. | | `integer` | Returns the vertical position, or zero after `destroy`. | #### tecs.platform.window.Window:progress Instance Reads taskbar or dock progress. ```teal function tecs.platform.window.Window.progress( self ): Window.Progress, number ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | [`Window.Progress`](/modules/platform/window/#tecs.platform.window.Window.Progress) | Returns the current state, or `"none"` after `destroy`. | | `number` | Returns progress from 0 to 1, or zero after `destroy`. | #### tecs.platform.window.Window:raise Instance Brings the window forward and requests input focus. Prefer `flash` when the user did not request a focus change. ```teal function tecs.platform.window.Window.raise(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:restore Instance Restores a minimized or maximized window. ```teal function tecs.platform.window.Window.restore(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:safeArea Instance Reads the unobstructed region inside the window. A desktop normally returns the whole window. Phones and handhelds may exclude notches, rounded corners or gesture areas. ```teal function tecs.platform.window.Window.safeArea( self ): integer, integer, integer, integer ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `integer` | Returns the horizontal offset in screen coordinates. | | `integer` | Returns the vertical offset in screen coordinates. | | `integer` | Returns the width in screen coordinates. | | `integer` | Returns the height in screen coordinates. | #### tecs.platform.window.Window:setAlwaysOnTop Instance Enables or disables always-on-top behavior. ```teal function tecs.platform.window.Window.setAlwaysOnTop( self, onTop: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `onTop` | `boolean` | The caller chooses whether to keep the window above others. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the change. | #### tecs.platform.window.Window:setAspectRatio Instance Constrains the width-over-height ratio. Equal values pin the window to one shape. ```teal function tecs.platform.window.Window.setAspectRatio( self, minimum: number, maximum: number ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `minimum` | `number` | The caller supplies the minimum ratio, or zero to remove that bound. | | `maximum` | `number` | The caller supplies the maximum ratio, or zero to remove that bound. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the bounds. | #### tecs.platform.window.Window:setBordered Instance Adds or removes the title bar and frame. The client area keeps its size. ```teal function tecs.platform.window.Window.setBordered( self, bordered: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `bordered` | `boolean` | The caller chooses whether to show desktop decoration. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the change. | #### tecs.platform.window.Window:setFocusable Instance Allows or forbids keyboard focus. A non-focusable window suits an overlay. ```teal function tecs.platform.window.Window.setFocusable( self, focusable: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `focusable` | `boolean` | The caller chooses whether the window may take focus. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the change. | #### tecs.platform.window.Window:setFullscreen Instance Enters or leaves fullscreen. With no selected mode, fullscreen uses the desktop resolution. With a mode from `setFullscreenMode`, it changes the display mode. The swapchain follows the new size on the next acquired frame. ```teal function tecs.platform.window.Window.setFullscreen( self, fullscreen: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `fullscreen` | `boolean` | The caller passes true to enter fullscreen or false to leave it. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:setFullscreenMode Instance Selects the video mode used by fullscreen. The mode must come from `fullscreenModes` or `closestFullscreenMode`; a hand-built record raises. Nil selects borderless fullscreen at the desktop resolution. ```teal function tecs.platform.window.Window.setFullscreenMode( self, mode: Window.DisplayMode ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `mode` | [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | The caller supplies a platform mode, or nil for borderless fullscreen. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the mode. | #### tecs.platform.window.Window:setHitRegions Instance Replaces the regions used for native window hit testing. The first region containing a point wins. Left and top edges are included; right and bottom edges are excluded. SDL copies no Lua state: Rust copies every record before this call returns and answers the native callback without entering LuaJIT. Pass nil or an empty list to restore ordinary desktop hit testing. Regions normally accompany a borderless window and must be updated after layout changes that move a title bar or resize border. ```teal function tecs.platform.window.Window.setHitRegions( self, regions: {Window.HitRegion} ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `regions` | `{`[`Window.HitRegion`](/modules/platform/window/#tecs.platform.window.Window.HitRegion)`}` | The caller supplies special regions in priority order, or nil to clear every region. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform installed, replaced or cleared the regions. | #### tecs.platform.window.Window:setIcon Instance Sets the image the desktop shows for the window. The call decodes the file synchronously. ```teal function tecs.platform.window.Window.setIcon( self, path: string ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `path` | `string` | The caller supplies the image path. Nil raises. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false when the decoder cannot read the file or after `destroy`. | #### tecs.platform.window.Window:setKeyboardGrab Instance Enables or disables interception of desktop keyboard shortcuts. Some desktops refuse this or require user permission. ```teal function tecs.platform.window.Window.setKeyboardGrab( self, grabbed: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `grabbed` | `boolean` | The caller chooses whether to intercept shortcuts while focused. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:setMaximumSize Instance Sets the maximum resize limit. ```teal function tecs.platform.window.Window.setMaximumSize( self, width: integer, height: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `width` | `integer` | The caller supplies the maximum width, or zero to remove that limit. | | `height` | `integer` | The caller supplies the maximum height, or zero to remove that limit. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the limits. | #### tecs.platform.window.Window:setMinimumSize Instance Sets the minimum resize limit. ```teal function tecs.platform.window.Window.setMinimumSize( self, width: integer, height: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `width` | `integer` | The caller supplies the minimum width, or zero to remove that limit. | | `height` | `integer` | The caller supplies the minimum height, or zero to remove that limit. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the limits. | #### tecs.platform.window.Window:setMouseGrab Instance Confines the pointer to the window or releases it. Unlike relative mouse mode, this leaves the pointer visible. An unfocused window records the request and resumes it on focus. ```teal function tecs.platform.window.Window.setMouseGrab( self, grabbed: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `grabbed` | `boolean` | The caller chooses whether to confine the pointer. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:setMouseRect Instance Confines the pointer to part of the window. This is independent of `setMouseGrab`. Call with no arguments to remove the region. ```teal function tecs.platform.window.Window.setMouseRect( self, x: integer, y: integer, width: integer, height: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `x` | `integer` | The caller supplies the horizontal offset, or nil to remove the region. | | `y` | `integer` | The caller supplies the vertical offset with `x`. | | `width` | `integer` | The caller supplies the region width with `x`. | | `height` | `integer` | The caller supplies the region height with `x`. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:setOpacity Instance Sets the window opacity. ```teal function tecs.platform.window.Window.setOpacity( self, opacity: number ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `opacity` | `number` | The caller supplies a value from 0 for invisible to 1 for solid. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the desktop accepted the change. | #### tecs.platform.window.Window:setPosition Instance Moves the window in desktop screen coordinates. The coordinate space spans all displays and may contain negative positions. ```teal function tecs.platform.window.Window.setPosition( self, x: integer, y: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `x` | `integer` | The caller supplies the horizontal position. | | `y` | `integer` | The caller supplies the vertical position. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:setProgress Instance Shows progress on the taskbar or dock. ```teal function tecs.platform.window.Window.setProgress( self, state: Window.Progress, value: number ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `state` | [`Window.Progress`](/modules/platform/window/#tecs.platform.window.Window.Progress) | The caller supplies `"none"`, `"indeterminate"`, `"normal"`, `"paused"` or `"error"`. An unknown value raises. | | `value` | `number` | The caller supplies progress from 0 to 1. The desktop reads it for `"normal"`, `"paused"` and `"error"`; omit it to keep the current value. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the desktop accepted the state and value. | #### tecs.platform.window.Window:setResizable Instance Allows or forbids user resizing. ```teal function tecs.platform.window.Window.setResizable( self, resizable: boolean ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `resizable` | `boolean` | The caller chooses whether the user may resize the window. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the change. | #### tecs.platform.window.Window:setSize Instance Resizes the window in screen coordinates. A fullscreen window ignores the request. A compositor may apply it after this returns; use `sync` before an immediate readback. ```teal function tecs.platform.window.Window.setSize( self, width: integer, height: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `width` | `integer` | The caller supplies the new width in screen coordinates. | | `height` | `integer` | The caller supplies the new height in screen coordinates. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform accepted the request. | #### tecs.platform.window.Window:setTitle Instance Sets the title and updates the public `title` field. ```teal function tecs.platform.window.Window.setTitle( self, title: string ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `title` | `string` | The caller supplies the new title. Nil raises. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform changed the title. | #### tecs.platform.window.Window:show Instance Maps a hidden window onto the desktop. ```teal function tecs.platform.window.Window.show(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the platform showed the window. | #### tecs.platform.window.Window:showSystemMenu Instance Opens the desktop's standard menu for this window. This supplies the platform menu used for operations such as moving the window between displays or workspaces. Unsupported desktops ignore the request. ```teal function tecs.platform.window.Window.showSystemMenu( self, x: integer, y: integer ): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | | `x` | `integer` | The caller supplies the horizontal position relative to the top-left of the window's client area. | | `y` | `integer` | The caller supplies the vertical position relative to the top-left of the window's client area. | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns whether the desktop accepted the request. | #### tecs.platform.window.Window:sync Instance Waits for the compositor to apply pending window changes. Size, position and fullscreen changes may land after their setters return. Call this only when code must read a changed value back immediately. ```teal function tecs.platform.window.Window.sync(self): boolean ``` ##### Arguments | Name | Type | Description | | --- | --- | --- | | `self` | `Window` | | ##### Returns | Type | Description | | --- | --- | | `boolean` | Returns false when the platform times out or after `destroy`. |