Renderer · class

ResolutionGovernor

Explained in Hello world.

class ResolutionGovernor
import { ResolutionGovernor } from '@driftengine/core';

Constructor

new

constructor(ceiling: number, limits?: Partial<GovernorLimits>)
ParameterTypeDescription
ceilingnumber
limits?Partial<GovernorLimits>

Accessors

NameTypeDescription
scalegetnumber

Methods

setCeiling

setCeiling(ceiling: number): void

The player's own ceiling moved.

ParameterTypeDescription
ceilingnumber
More

A lower ceiling applies at once, because their choice is authority and waiting a window to honour it would be ignoring them. A higher one is only a permission: it does not raise the current scale, because jumping up would undo a drop the device had already earned. The patience path decides whether it can afford to climb back.

reset

reset(): void

Start the window again, leaving the scale where it is.

sample

sample(frameMs: number, playable: boolean): number | null

One frame. Returns the new scale when it changed and null when it did not, so the caller does no GL or DOM work on an ordinary frame.

ParameterTypeDescription
frameMsnumber
playableboolean
More

playable exists because of DZTF9F, where an RTX 3060 filed a report calling itself unplayable from a menu: a menu frame and a hidden-tab frame are not verdicts about the machine. A governor that believed them would soften a game running perfectly, which is the same false positive with a more visible symptom.