[page:App] →
[name]
Deprecated. Use [page:PuzzlesLoader] instead.
A class for setting up a 3D application, capable of loading the Puzzles
editor and executing visual logic code.
Performs app initialization/loading in the following order:
- starts loading a scene, a logic script and the Puzzles Editor depending
on the method used ([page:.loadScene], [page:.loadSceneWithLogic],
[page:.loadSceneWithEditor])
- calls the corresponding callback ([page:.onSceneLoad],
[page:.onLogicLoad], [page:.onEditorLoad])
when something is loaded or the [page:.onError] callback in
case of an error
- calls the [page:.onLoadFinished] callback after all loading
actions were finished successfully or not
- removes the preloader, starts the rendering cycle and
executes the logic script successively by calling the
[page:.run] method.
Constructor
[name](containerId, ctxSettings, preloader)
[page:String containerId] - the id of an HTML-element containing the canvas.
[page:Object ctxSettings] - the WebGL context attributes to be passed in the 'canvas.getContext()' method.
[page:Preloader preloader] - the application's Preloader.
Properties
See the base [page:App] class for common properties.
[property:Object ExternalInterface]
An object containing functions created in the Puzzles Editor to
access them from the application's code. Typical usage: calling a
function manually, setting/overriding a function.
Methods
See the base [page:App] class for common methods.
[method:null loadScene](url)
Load a gltf scene specified by the url parameter.
[method:null loadSceneWithEditor](url, logicURL, editorDir)
Load a gltf scene along with the Puzzles Editor. The editor needs
to be provided with the path to the target logic JS file (specified
by the logicURL parameter) and with the path to the Puzzles
Editor's resource folder (specified by the editorDir parameter,
should have the content of the SDK's 'puzzles' folder).
[method:null loadSceneWithLogic](url, logicURL)
Load a gltf scene along with the code generated from the Puzzles
Editor (specified by the logicURL parameter).
[method:null onEditorLoad]()
A callback, called when the Puzzles Editor was successfully loaded.
[method:null onError](error)
A callback, called when an error is occured during the loading process.
Some specific errors with the following names are also generated:
-
EditorLoadError - the Puzzles Editor wasn't properly loaded
-
LogicLoadError - the logic file wasn't properly loaded
-
SceneLoadError - the scene file wasn't properly loaded
Prints all errors in the browser console by default.
[method:null onLoadFinished](sceneLoaded, logicLoaded, editorLoaded)
A callback, called when all loading actions are finsihed successfully
or not, which is indicated by its parameters: sceneLoaded,
logicLoaded and editorLoaded.
By default calls the [page:.run] method if a scene was loaded.
[method:null onLogicLoad]()
A callback, called when the logic file was successfully loaded.
[method:null onSceneLoad]()
A callback, called when the scene file was successfully loaded.
[method:null run]()
Starts the application by removing the preloader, starting the
rendering cycle and executing the logic script.