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 DisplayControlimport { 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)| Parameter | Type | Description |
|---|---|---|
bridge | DriftHostBridge |
Accessors
| Name | Type | Description |
|---|---|---|
refreshHzget | number | null | A real number, which is the whole reason the browser implementation returns null.MoreRead 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(): booleansetFullscreen
setFullscreen(on: boolean): Promise<void>| Parameter | Type | Description |
|---|---|---|
on | boolean |
mode
mode(): WindowModesetMode
setMode(mode: WindowMode): Promise<boolean>| Parameter | Type | Description |
|---|---|---|
mode | WindowMode |
size
size(): { readonly width: number; readonly height: number; }canSetSize
canSetSize(): booleanThe 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>| Parameter | Type | Description |
|---|---|---|
width | number | |
height | number |
displays
displays(): readonly DisplayInfo[]