Host · interface
DisplayControl
Explained in Display and the host.
interface DisplayControlimport type { DisplayControl } from '@driftengine/core';Properties
| Name | Type | Description |
|---|---|---|
refreshHzreadonly | number | null | The refresh rate of the display the game is on, or null where the platform will not say. |
Methods
mode
mode(): WindowModeWhich mode the game is in right now, read rather than remembered.
setMode
setMode(mode: WindowMode): Promise<boolean>false where the platform refused or cannot. Never rejects.
| Parameter | Type | Description |
|---|---|---|
mode | WindowMode |
isFullscreen
isFullscreen(): booleansetFullscreen
setFullscreen(on: boolean): Promise<void>Never rejects. A browser refuses fullscreen outside a gesture, which is ordinary.
| Parameter | Type | Description |
|---|---|---|
on | boolean |
size
size(): { readonly width: number; readonly height: number; }The drawing surface, in logical pixels.
canSetSize
canSetSize(): booleanWhether setSize would work right now, asked without performing one.
More
A question rather than a mutation, since 2026-08-28. false from setSize was the only
way to learn this, and setSize is the mutator — so a settings screen deciding whether to
draw a resolution control at all had to call the thing that changes the window in order to
find out whether it may. Reported from outside, where the workaround was a no-op probe at
boot, setSize(...size()), with a paragraph explaining that it is not what it looks like.
Read on each call and not a constant, for the reason mode() is a call: a shell that can
resize a window cannot resize one that is covering a display, so the answer changes with the
window mode. A screen that greys its control reads this when it draws.
It must agree with setSize, and in a shell that agreement is one function rather than two
conditions written twice — see ipc.ts. Two implementations of one decision drift, and here
they would drift into a greyed control that works or a live one that does not.
The engine already had this shape and this surface lacked it: pad.canRumble says whether
a browser can drive a pad's motors at all, beside a rumble that answers whether the call was
taken. A question and a mutation, and the question is the half a settings screen draws with.
setSize
setSize(width: number, height: number): Promise<boolean>Resize the drawing surface. false where the platform will not — a browser never can, and a
shell will not while the window is covering a display.
| Parameter | Type | Description |
|---|---|---|
width | number | |
height | number |
displays
displays(): readonly DisplayInfo[]Every display the platform will admit to. Never empty where at least one is known.