hengine
Version:
A simple graphic engine for `canvasom`.
59 lines (58 loc) • 1.72 kB
TypeScript
import { Resizer, ResizerOptions, SizingOutput } from '3h-resize';
import { CanvasNodeEvents, CanvasRoot, CanvasRootOptions } from 'canvasom';
import type { SceneNode } from './SceneNode';
/**
* Type of options of canvas engines.
*/
export declare type CanvasEngineOptions<Events extends CanvasNodeEvents> = (CanvasRootOptions<Events> & Partial<{
/**
* The resizer options.
* @default
* ```js
* {
* width: this.renderer.width,
* height: this.renderer.height,
* target: this.renderer.canvas,
* sizing: HR.Sizing.contain,
* callback: this.onResize,
* }
* ```
*/
resizerOptions: ResizerOptions;
}>);
/** dts2md break */
/**
* Class of canvas engines.
*/
export declare class CanvasEngine<Events extends CanvasNodeEvents = CanvasNodeEvents> extends CanvasRoot<Events> {
/** dts2md break */
/**
* Constructor of {@link CanvasEngine}.
*/
constructor(options?: CanvasEngineOptions<Events>);
/** dts2md break */
/**
* The resizer in use.
*/
readonly resizer: Resizer;
/** dts2md break */
/**
* Current scene.
*/
currentScene: SceneNode | null;
/** dts2md break */
/**
* Resize callback.
* (Remember to invoke this in your implemention
* of `resizer.callback` if you have one.)
*/
onResize(result: SizingOutput): void;
/** dts2md break */
/**
* Enter specific scene.
* (Pass `null` to exit current scene
* without entering another scene.)
* @returns Whether the scene change is successful.
*/
enter(nextScene: SceneNode | null): boolean;
}