App

AppPuzzles

Deprecated. Use 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:

Constructor

AppPuzzles(containerId, ctxSettings, preloader)

containerId - the id of an HTML-element containing the canvas.
ctxSettings - the WebGL context attributes to be passed in the 'canvas.getContext()' method.
preloader - the application's Preloader.

Properties

See the base App class for common properties.

.ExternalInterface : Object

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 App class for common methods.

.loadScene (url) : null

Load a gltf scene specified by the url parameter.

.loadSceneWithEditor (url, logicURL, editorDir) : null

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).

.loadSceneWithLogic (url, logicURL) : null

Load a gltf scene along with the code generated from the Puzzles Editor (specified by the logicURL parameter).

.onEditorLoad () : null

A callback, called when the Puzzles Editor was successfully loaded.

.onError (error) : null

A callback, called when an error is occured during the loading process. Some specific errors with the following names are also generated: Prints all errors in the browser console by default.

.onLoadFinished (sceneLoaded, logicLoaded, editorLoaded) : null

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 .run method if a scene was loaded.

.onLogicLoad () : null

A callback, called when the logic file was successfully loaded.

.onSceneLoad () : null

A callback, called when the scene file was successfully loaded.

.run () : null

Starts the application by removing the preloader, starting the rendering cycle and executing the logic script.