Base class for a Heaps application.

This class contains code to set up a typical Heaps app, including 3D and 2D scene, input, update and loops.

It's designed to be a base class for an application entry point, and provides several methods for overriding, in which we can plug custom code. See API documentation for more information.

Constructor

new ()

Variables

read onlyengine:Engine

Rendering engine.

read onlys2d:Scene

Default 2D scene.

read onlys3d:Scene

Default 3D scene.

read onlysevents:SceneEvents

Input event listener collection. Both 2D and 3D scenes are added to it by default.

Methods

privateinit ():Void

Initialize application.

Called during application setup after loadAssets completed. By default does nothing. Override this method to provide application initialization logic.

privateloadAssets (onLoaded:Void ‑> Void):Void

Load assets asynchronously.

Called during application setup. By default immediately calls onLoaded. Override this method to provide asynchronous asset loading logic.

Parameters:

onLoaded

a callback that should be called by the overriden method when loading is complete

privateonResize ():Void

Screen resize callback.

By default does nothing. Override this method to provide custom on-resize logic.

render (e:Engine):Void

setScene (scene:InteractiveScene, ?disposePrevious:Bool):Void

Switch either the 2d or 3d scene with another instance, both in terms of rendering and event handling. If you call disposePrevious, it will call dispose() on the previous scene.

privateupdate (dt:Float):Void

Update application.

Called each frame right before rendering. First call is done after the application is set up (so loadAssets and init are called).

Parameters:

dt

Time elapsed since last frame, normalized.