Packaging · class

NativeDisplay

The video half of a settings screen, on a platform that can actually answer it.

Explained in Packaging an application.

class NativeDisplay implements DisplayControl
import { NativeDisplay } from '@driftengine/package';

In depth

Every member here is the same call the browser implementation makes and refuses. That is the point of the pair: a game writes one settings screen against DisplayControl, and it is fully populated in a shell and honestly degraded in a tab — a resolution list that reports false from setSize is a control the game greys out rather than one that silently does nothing.

Constructor

new

constructor(bridge: DriftHostBridge)
ParameterTypeDescription
bridgeDriftHostBridge

Accessors

NameTypeDescription
refreshHzgetnumber | nullA real number, which is the whole reason the browser implementation returns null.
More

Read on each access rather than captured in the constructor: a window moved to another monitor changes it, and a value from boot would be the previous monitor's.

Methods

isFullscreen

isFullscreen(): boolean

setFullscreen

setFullscreen(on: boolean): Promise<void>
ParameterTypeDescription
onboolean

mode

mode(): WindowMode

setMode

setMode(mode: WindowMode): Promise<boolean>
ParameterTypeDescription
modeWindowMode

size

size(): { readonly width: number; readonly height: number; }

canSetSize

canSetSize(): boolean

The question, asked without performing the resize.

More

The shell decides it with the same function that decides whether setSize refuses, so the two cannot disagree — see main/ipc.ts. Before this existed the only way to learn the answer was to call setSize, and a consumer's settings screen probed it at boot by resizing the window to the size it already had.

setSize

setSize(width: number, height: number): Promise<boolean>
ParameterTypeDescription
widthnumber
heightnumber

displays

displays(): readonly DisplayInfo[]