Skip to content

GameLoop

Defined in: GameLoop.ts:25

Game loop with fixed timestep accumulator.

Driven by an external ticker (e.g., PixiJS Ticker) or manual tick() calls for testing. Implements deterministic fixed updates with variable rendering.

new GameLoop(config?): GameLoop

Defined in: GameLoop.ts:39

GameLoopConfig

GameLoop

readonly fixedTimestep: number

Defined in: GameLoop.ts:27

Fixed timestep in ms.


readonly maxFixedStepsPerFrame: number

Defined in: GameLoop.ts:29

Max fixed steps per frame.

get frameCount(): number

Defined in: GameLoop.ts:45

Current frame count.

number


get interpolationAlpha(): number

Defined in: GameLoop.ts:55

Ratio of accumulated time to fixed timestep, for physics interpolation.

number


get isRunning(): boolean

Defined in: GameLoop.ts:50

Whether the loop is running.

boolean

attachTicker(subscribe): void

Defined in: GameLoop.ts:69

Attach an external ticker (e.g., PixiJS Ticker). The ticker calls tick(dt) every frame. If no ticker is attached, the loop uses requestAnimationFrame.

(callback) => () => void

void


setCallbacks(callbacks): void

Defined in: GameLoop.ts:60

Provide the callbacks that the loop invokes each frame.

GameLoopCallbacks

void


start(): void

Defined in: GameLoop.ts:76

Start the loop.

void


stop(): void

Defined in: GameLoop.ts:97

Stop the loop.

void


tick(dtMs): void

Defined in: GameLoop.ts:110

Process one frame with the given dt in milliseconds.

number

void