the-world-engine
Version:
three.js based, unity like game engine for browser
75 lines (74 loc) • 2.37 kB
TypeScript
import type { Bootstrapper } from "./bootstrap/Bootstrapper";
import type { BootstrapperConstructor } from "./bootstrap/BootstrapperConstructor";
import { GameStateKind } from "./GameState";
import type { IInputEventHandleable } from "./input/IInputEventHandleable";
/**
* game engine class
*/
export declare class Game {
private readonly _rootScene;
private readonly _gameScreen;
private _css3DRenderer?;
private _threeColor?;
private _webglRenderer?;
private _webglRendererDomElement?;
private readonly _cameraContainer;
private readonly _time;
private readonly _gameState;
private readonly _sceneProcessor;
private readonly _coroutineProcessor;
private readonly _transformMatrixProcessor;
private readonly _physics2DProcessor;
private readonly _engineGlobalObject;
private _webGLGlobalObject?;
private readonly _container;
private _gameSetting;
private _animationFrameId;
private _isDisposed;
private readonly _autoResize;
private readonly _resizeFrameBufferBind;
private readonly _loopBind;
/**
*
* @param container html element that mount the game view
* @param autoResize if true, the game view will be resized when the window is resized. (default: true)
*/
constructor(container: HTMLElement, autoResize?: boolean);
/**
* resize the game view, update the camera matrix
*/
resizeFramebuffer(): void;
/**
* run game
* @param bootstrapperCtor bootstrapper constructor is used to initialize the game.
* @param interopObject interop object passed to the bootstrapper.
*/
run<T, U extends Bootstrapper<T> = Bootstrapper<T>>(bootstrapperCtor: BootstrapperConstructor<T, U>, interopObject?: T): void;
private loop;
/**
* stop game (you can resume game after game is stopped.)
*/
stop(): void;
/**
* resume game
*/
resume(): void;
/**
* dispose game
*
* dispose game will dispose all resources used by game.
*
* game will be unmounted from the dom.
*
* after dispose, you can't use game anymore.
*/
dispose(): void;
/**
* get inputHandler for eventhandle toggle.
*/
get inputHandler(): IInputEventHandleable;
/**
* get current game state
*/
get currentGameState(): GameStateKind;
}