import { Game } from "../Game" ; import { SceneNode , PostDrawHints } from "./SceneNode" ; import { Direction } from "../geom/Direction" ; import { Scene } from "../Scene" ; /**
 * Function signature for updating the root node. This function is exposed to the scene through the constructor so
 * the scene can call it but no one else can by accident.
 */ export type UpdateRootNode = ( dt : number ) => number ; /**
 * Function signature for drawing the root node.
 */ export type DrawRootNode = ( ctx : CanvasRenderingContext2D , layer : number , width : number , height : number ) => PostDrawHints ; param T export class RootNode < T extends Game = Game > extends SceneNode < T > { param scene param expose public constructor ( scene , expose ) { super ( { anchor : Direction . TOP_LEFT , childAnchor : Direction . TOP_LEFT } ) ; this . scene = scene ; expose ( this . updateAll . bind ( this ) , this . drawAllWithBounds . bind ( this ) ) ; } param ctx param width param height return private drawAllWithBounds ( ctx , layer , width , height ) { const flags = this . drawAll ( ctx , layer , width , height ) ; if ( ( flags & PostDrawHints . DRAW_BOUNDS ) !== 0 ) { this . drawBounds ( ctx ) ; } return flags ; } }