import { Stage } from "./stage/stage"; import { YieldQueue } from "./yield/yield-queue"; import { WebGLRenderer } from "three"; export interface RendererOptions { antialias: boolean; alpha: boolean; fullscreen: boolean; } /** * Renderer is a singleton type that can be accessed from anywhere in the application. * Only a single instance of this class exists. Use Renderer.instance to access. * * Renderer manages the global event loop and all required callbacks. */ export declare class Renderer { private static readonly _DEFAULT_OPT; private static readonly _RENDERER_SIZE; private static readonly _INSTANCE; private readonly _yield; private readonly _fullScreenListener; private _threeRenderer; private _threeCanvas; private _stage; private _devMode; private _isPaused; private _isStarted; private _isFullscreen; private _width; private _height; private constructor(); get threeRenderer(): WebGLRenderer; get canvas(): HTMLCanvasElement; get stage(): Stage; set stage(stage: Stage); setStage(stage: Stage, destroyOldStage?: boolean): void; /** * Choose how to handle error, this could be piped to a user-friendly context * * @param error - the error to handle (if any) */ errorOrPass(error: Error | string | undefined | null): void; /** * Enable/Disable more strict checking for certain engine routines. This is good * for development mode to make sure everything is running correctly. Some parts of * the engine will run slower so this should be disabled for production. * * Disabled by default */ get devMode(): boolean; set devMode(value: boolean); /** * Checks if the Renderer is paused or running */ get paused(): boolean; /** * Check if the Renderer has started running */ get started(): boolean; get yield(): YieldQueue; pause(): void; resume(): void; start(): void; /** * Initialise the Renderer provided a Canvas * * @param canvas - The HTML Canvas to load */ init(canvas: HTMLCanvasElement | undefined | null, options?: RendererOptions | undefined | null): void; get width(): number; get height(): number; /** * Initialise the Renderer provided a Canvas ID. Ensure that the Canvas element is loaded * before calling this function * * @param canvasID - The HTML Canvas id to load */ initWithID(canvasID: string, options?: RendererOptions | undefined | null): void; /** * Ensure the Renderer is always full-screen and covers the entire * screen. This will automatically adjust the renderer size if the * screen size changes. */ get fullscreen(): boolean; set fullscreen(value: boolean); resize(width: number, height: number): void; /** * Access the one and only Global Renderer instance */ static get instance(): Renderer; private _lastTime; /** * internal loop function */ private readonly loop; }