diff --git a/dist/index.html b/dist/index.html index 37a2dd2..06f1352 100644 --- a/dist/index.html +++ b/dist/index.html @@ -22,7 +22,8 @@ diff --git a/dist/r3.js b/dist/r3.js index 204787f..7d799ab 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { static version = '2.0.758'; - static compileDate = '2021 Sep 18 - 08:48:43 am'; + static compileDate = '2021 Sep 18 - 11:04:13 am'; } class Runtime { @@ -25,6 +25,827 @@ Runtime.BASE_IMAGE = 0x4; Runtime.BASE_PHYSICS = 0x5; Runtime.BASE_SOCKET = 0x6; Runtime.BASE_STATISTICS = 0x7; +Runtime.CODE_MIRROR = 0x8; +Runtime.DOCUMENT = 0x9; +Runtime.CONTROL_KIT = 0xa; +Runtime.THREE = 0xb; +Runtime.NODE_JS_IMAGE = 0xc; +Runtime.WEB_IMAGE = 0xd; +Runtime.BULLET = 0xe; +Runtime.STATS = 0xf; + +class RuntimeCoder extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +/** + + Class R3.Runtime.Coder.CodeMirror + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeCoder] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeCodeMirror] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeCodeMirror extends RuntimeCoder { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} + +class RuntimeDOM extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +Runtime.DOCUMENT = 0x9; + +/** + + Class R3.Runtime.DOM.Document + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeDOM] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeDocument] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeDocument extends RuntimeDOM { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + if (component instanceof R3.Component.DOM.Canvas) { + let canvas = document.createElement('canvas'); + canvas.setAttribute('width', component.width); + canvas.setAttribute('height', component.height); + canvas.setAttribute('style', component.style); + return canvas; + } + + } + +} + +class RuntimeGUI extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +Runtime.CONTROL_KIT = 0xa; + +/** + + Class R3.Runtime.GUI.ControlKit + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeGUI] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeControlKit] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeControlKit extends RuntimeGUI { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} + +class RuntimeGraphics extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +Runtime.THREE = 0xb; + +/** + + Class R3.Runtime.Graphics.Three + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeThree] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeThree extends RuntimeGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} + +class RuntimeImage extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +Runtime.NODE_JS_IMAGE = 0xc; +Runtime.WEB_IMAGE = 0xd; + +/** + + Class R3.Runtime.Image.NodeJSImage + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeImage] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeNodeJSImage] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeNodeJSImage extends RuntimeImage { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} + +/** + + Class R3.Runtime.Image.WebImage + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeImage] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeWebImage] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeWebImage extends RuntimeImage { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} + +class RuntimePhysics extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +Runtime.BULLET = 0xe; + +/** + + Class R3.Runtime.Physics.Bullet + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimePhysics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeBullet] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeBullet extends RuntimePhysics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} + +class RuntimeSocket extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +class RuntimeStatistics extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + } + +} + +Runtime.STATS = 0xf; + +/** + + Class R3.Runtime.Statistics.Stats + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeStatistics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeStats] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeStats extends RuntimeStatistics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates an instance of R3.Component based on this Runtime. + * @param component + */ + buildInstance(component) { + + } + +} class System { @@ -40,15 +861,1079 @@ class System { } -System.SYSTEM_DOM = 0x0; -System.SYSTEM_INPUT = 0x1; -System.SYSTEM_LINKING = 0x2; -System.SYSTEM_RENDER = 0x3; -System.SYSTEM_RUNTIME = 0x4; -System.SYSTEM_SOCKET = 0x5; -System.SYSTEM_STORAGE = 0x6; +System.DOM = 0x0; +System.INPUT = 0x1; +System.LINKING = 0x2; +System.RENDER = 0x3; +System.RUNTIME = 0x4; +System.SOCKET = 0x5; +System.STORAGE = 0x6; System.MAX_SYSTEM = 0x7; +/** + + Class R3.System.DOM + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemDOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class SystemDOM extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'] = Event.Subscribe( + Event.DOM_COMPONENT_INITIALIZED, + SystemDOM.OnDomComponentInitialized + ); + + SystemDOM.Started = true; + + console.log('Started system: SystemDOM'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'].remove(); + delete SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED']; + + SystemDOM.Started = false; + + console.log('Stopped system: SystemDOM'); + + } + + /** + * OnDomComponentInitialized() + * - Listens to events of type Event.DOM_COMPONENT_INITIALIZED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnDomComponentInitialized(object) { + + object.createInstance(); + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemDOM.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemDOM.Subscriptions = {}; + +/** + + Class R3.System.Input + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemInput] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class SystemInput extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemInput.Subscriptions['TOUCH_START'] = Event.Subscribe( + Event.TOUCH_START, + SystemInput.OnTouchStart + ); + + SystemInput.Subscriptions['TOUCH_END'] = Event.Subscribe( + Event.TOUCH_END, + SystemInput.OnTouchEnd + ); + + SystemInput.Subscriptions['TOUCH_MOVE'] = Event.Subscribe( + Event.TOUCH_MOVE, + SystemInput.OnTouchMove + ); + + SystemInput.Subscriptions['TOUCH_CANCEL'] = Event.Subscribe( + Event.TOUCH_CANCEL, + SystemInput.OnTouchCancel + ); + + SystemInput.Subscriptions['KEYBOARD_DOWN'] = Event.Subscribe( + Event.KEYBOARD_DOWN, + SystemInput.OnKeyboardDown + ); + + SystemInput.Subscriptions['KEYBOARD_UP'] = Event.Subscribe( + Event.KEYBOARD_UP, + SystemInput.OnKeyboardUp + ); + + SystemInput.Subscriptions['MOUSE_DOWN'] = Event.Subscribe( + Event.MOUSE_DOWN, + SystemInput.OnMouseDown + ); + + SystemInput.Subscriptions['MOUSE_UP'] = Event.Subscribe( + Event.MOUSE_UP, + SystemInput.OnMouseUp + ); + + SystemInput.Subscriptions['MOUSE_MOVE'] = Event.Subscribe( + Event.MOUSE_MOVE, + SystemInput.OnMouseMove + ); + + SystemInput.Subscriptions['MOUSE_WHEEL'] = Event.Subscribe( + Event.MOUSE_WHEEL, + SystemInput.OnMouseWheel + ); + + SystemInput.Started = true; + + console.log('Started system: SystemInput'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemInput.Subscriptions['TOUCH_START'].remove(); + delete SystemInput.Subscriptions['TOUCH_START']; + + SystemInput.Subscriptions['TOUCH_END'].remove(); + delete SystemInput.Subscriptions['TOUCH_END']; + + SystemInput.Subscriptions['TOUCH_MOVE'].remove(); + delete SystemInput.Subscriptions['TOUCH_MOVE']; + + SystemInput.Subscriptions['TOUCH_CANCEL'].remove(); + delete SystemInput.Subscriptions['TOUCH_CANCEL']; + + SystemInput.Subscriptions['KEYBOARD_DOWN'].remove(); + delete SystemInput.Subscriptions['KEYBOARD_DOWN']; + + SystemInput.Subscriptions['KEYBOARD_UP'].remove(); + delete SystemInput.Subscriptions['KEYBOARD_UP']; + + SystemInput.Subscriptions['MOUSE_DOWN'].remove(); + delete SystemInput.Subscriptions['MOUSE_DOWN']; + + SystemInput.Subscriptions['MOUSE_UP'].remove(); + delete SystemInput.Subscriptions['MOUSE_UP']; + + SystemInput.Subscriptions['MOUSE_MOVE'].remove(); + delete SystemInput.Subscriptions['MOUSE_MOVE']; + + SystemInput.Subscriptions['MOUSE_WHEEL'].remove(); + delete SystemInput.Subscriptions['MOUSE_WHEEL']; + + SystemInput.Started = false; + + console.log('Stopped system: SystemInput'); + + } + + /** + * OnTouchStart() + * - Listens to events of type Event.TOUCH_START and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnTouchStart(object) { + + } + + /** + * OnTouchEnd() + * - Listens to events of type Event.TOUCH_END and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnTouchEnd(object) { + + } + + /** + * OnTouchMove() + * - Listens to events of type Event.TOUCH_MOVE and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnTouchMove(object) { + + } + + /** + * OnTouchCancel() + * - Listens to events of type Event.TOUCH_CANCEL and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnTouchCancel(object) { + + } + + /** + * OnKeyboardDown() + * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnKeyboardDown(object) { + + } + + /** + * OnKeyboardUp() + * - Listens to events of type Event.KEYBOARD_UP and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnKeyboardUp(object) { + + } + + /** + * OnMouseDown() + * - Listens to events of type Event.MOUSE_DOWN and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnMouseDown(object) { + + } + + /** + * OnMouseUp() + * - Listens to events of type Event.MOUSE_UP and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnMouseUp(object) { + + } + + /** + * OnMouseMove() + * - Listens to events of type Event.MOUSE_MOVE and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnMouseMove(object) { + + } + + /** + * OnMouseWheel() + * - Listens to events of type Event.MOUSE_WHEEL and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnMouseWheel(object) { + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemInput.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemInput.Subscriptions = {}; + +/** + + Class R3.System.Linking + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemLinking] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class SystemLinking extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemLinking.Subscriptions['OBJECT_CREATED'] = Event.Subscribe( + Event.OBJECT_CREATED, + SystemLinking.OnObjectCreated + ); + + SystemLinking.Subscriptions['OBJECT_INITIALIZED'] = Event.Subscribe( + Event.OBJECT_INITIALIZED, + SystemLinking.OnObjectInitialized + ); + + SystemLinking.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( + Event.INSTANCE_CREATED, + SystemLinking.OnInstanceCreated + ); + + SystemLinking.Started = true; + + console.log('Started system: SystemLinking'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemLinking.Subscriptions['OBJECT_CREATED'].remove(); + delete SystemLinking.Subscriptions['OBJECT_CREATED']; + + SystemLinking.Subscriptions['OBJECT_INITIALIZED'].remove(); + delete SystemLinking.Subscriptions['OBJECT_INITIALIZED']; + + SystemLinking.Subscriptions['INSTANCE_CREATED'].remove(); + delete SystemLinking.Subscriptions['INSTANCE_CREATED']; + + SystemLinking.Started = false; + + console.log('Stopped system: SystemLinking'); + + } + + /** + * OnObjectCreated() + * - Listens to events of type Event.OBJECT_CREATED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnObjectCreated(object) { + + console.log('Object Created'); + + } + + /** + * OnObjectInitialized() + * - Listens to events of type Event.OBJECT_INITIALIZED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnObjectInitialized(object) { + + console.log('Object Initialized : ' + object.constructor.name); + + } + + /** + * OnInstanceCreated() + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnInstanceCreated(object) { + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemLinking.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemLinking.Subscriptions = {}; + +/** + + Class R3.System.Render + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemRender] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class SystemRender extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemRender.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( + Event.INSTANCE_CREATED, + SystemRender.OnInstanceCreated + ); + + SystemRender.Started = true; + + console.log('Started system: SystemRender'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemRender.Subscriptions['INSTANCE_CREATED'].remove(); + delete SystemRender.Subscriptions['INSTANCE_CREATED']; + + SystemRender.Started = false; + + console.log('Stopped system: SystemRender'); + + } + + /** + * OnInstanceCreated() + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnInstanceCreated(object) { + + if (object instanceof R3.Component.DOM) { + if (object.runtime instanceof R3.Runtime.DOM.Document) { + document.body.appendChild(object.instance); + } + } + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemRender.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemRender.Subscriptions = {}; + +/** + + Class R3.System.Runtime + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemRuntime] + + Properties: + + + + Static Properties: + + - Projects (Default value []) + - CurrentProject (Default value null) + - RuntimeCoder (Default value {}) + - RuntimeDOM (Default value {}) + - RuntimeGUI (Default value {}) + - RuntimeGraphics (Default value {}) + - RuntimePhysics (Default value {}) + - RuntimeStatistics (Default value {}) + + Methods: + + + + Static Methods: + + + + **/ + +class SystemRuntime extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemRuntime.Subscriptions['GET_RUNTIME'] = Event.Subscribe( + Event.GET_RUNTIME, + SystemRuntime.OnGetRuntime + ); + + SystemRuntime.Subscriptions['PROJECT_INITIALIZED'] = Event.Subscribe( + Event.PROJECT_INITIALIZED, + SystemRuntime.OnProjectInitialized + ); + + SystemRuntime.Started = true; + + console.log('Started system: SystemRuntime'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemRuntime.Subscriptions['GET_RUNTIME'].remove(); + delete SystemRuntime.Subscriptions['GET_RUNTIME']; + + SystemRuntime.Subscriptions['PROJECT_INITIALIZED'].remove(); + delete SystemRuntime.Subscriptions['PROJECT_INITIALIZED']; + + SystemRuntime.Started = false; + + console.log('Stopped system: SystemRuntime'); + + } + + /** + * OnGetRuntime() + * - Listens to events of type Event.GET_RUNTIME and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnGetRuntime(object) { + + if (object instanceof R3.Component.DOM) { + + if (SystemRuntime.CurrentProject === null) { + return new R3.Runtime.DOM.Document(); + } else { + console.log('TODO: implement a project based DOM runtime'); + } + } + + if (object instanceof R3.Image) { + + if (SystemRuntime.CurrentProject === null) { + return new R3.Runtime.Image.WebImage(); + } else { + console.log('TODO: implement a project based Image runtime'); + } + } + + } + + /** + * OnProjectInitialized() + * - Listens to events of type Event.PROJECT_INITIALIZED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnProjectInitialized(object) { + + Utils.PushUnique(SystemRuntime.Projects, object); + SystemRuntime.CurrentProject = object; + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemRuntime.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemRuntime.Subscriptions = {}; + +/** + * static Projects - No comment + */ +SystemRuntime.Projects = []; + +/** + * static CurrentProject - No comment + */ +SystemRuntime.CurrentProject = null; + +/** + * static RuntimeCoder - No comment + */ +SystemRuntime.RuntimeCoder = {}; + +/** + * static RuntimeDOM - No comment + */ +SystemRuntime.RuntimeDOM = {}; + +/** + * static RuntimeGUI - No comment + */ +SystemRuntime.RuntimeGUI = {}; + +/** + * static RuntimeGraphics - No comment + */ +SystemRuntime.RuntimeGraphics = {}; + +/** + * static RuntimePhysics - No comment + */ +SystemRuntime.RuntimePhysics = {}; + +/** + * static RuntimeStatistics - No comment + */ +SystemRuntime.RuntimeStatistics = {}; + +/** + + Class R3.System.Socket + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemSocket] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class SystemSocket extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemSocket.Started = true; + + console.log('Started system: SystemSocket'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemSocket.Started = false; + + console.log('Stopped system: SystemSocket'); + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemSocket.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemSocket.Subscriptions = {}; + +/** + + Class R3.System.Storage + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemStorage] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class SystemStorage extends System { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + Object.assign(this, options); + + } + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'] = Event.Subscribe( + Event.IMAGE_COMPONENT_INITIALIZED, + SystemStorage.OnImageComponentInitialized + ); + + SystemStorage.Started = true; + + console.log('Started system: SystemStorage'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'].remove(); + delete SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED']; + + SystemStorage.Started = false; + + console.log('Stopped system: SystemStorage'); + + } + + /** + * OnImageComponentInitialized() + * - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return null + */ + static OnImageComponentInitialized(object) { + + object.createInstance(); + + } + +} + +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemStorage.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is listening + * to. The system can stop receiving events by calling remove() on a handle. + */ +SystemStorage.Subscriptions = {}; + class Event { constructor(options) { @@ -360,6 +2245,2842 @@ Event.GetEventName = function(eventId) { }; +/** + + Class R3.Event.Object + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Belonging to R3Object] + + Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Static Properties: + + + + Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Static Methods: + + + + **/ + +class R3Object extends Event { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * id - Each Object receives an 10 digit random ID which uniquely identifies it everywhere (client and + * server side) + */ + if (typeof options.id === 'undefined') { + options.id = Utils.RandomId(10); + } + /** + * name - Each Object has a name + */ + if (typeof options.name === 'undefined') { + options.name = 'Object ' + options.id; + } + /** + * register - No comment + */ + if (typeof options.register === 'undefined') { + options.register = true; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Should raises an event(s) which indicates that this object initialized + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + + } + +} + +/** + + Class R3.Event.Object.Entity + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Belonging to Entity] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class Entity extends R3Object { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + this.emit(Event.ENTITY_CREATED, this); + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Should raises an event(s) which indicates that this object initialized + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.ENTITY_INITIALIZED, this); + + } + +} + +Entity.SLIDER = 0x0; +Entity.MAX_ENTITY = 0x1; + +/** + + Class R3.Event.Object.Entity.Slider + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Entity] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to EntitySlider] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class EntitySlider extends Entity { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * components - A list of components that this entity is composed of + */ + if (typeof options.components === 'undefined') { + options.components = []; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + +} + +/** + + Class R3.Event.Object.Component + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Belonging to Component] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class Component extends R3Object { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + this.emit(Event.COMPONENT_CREATED, this); + + /** + * register - No comment + */ + if (typeof options.register === 'undefined') { + options.register = true; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Should raises an event(s) which indicates that this object initialized + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + + } + + /** + * createInstance() + * - Creates an instance of this object based on the current runtime + */ + createInstance() { + + this.emit(Event.CREATE_INSTANCE_BEFORE, this); + + this.setRuntime(); + + this.instance = this.runtime.buildInstance(this); + + this.emit(Event.INSTANCE_CREATED, this); + + } + + /** + * dispose() + * - Disposes of this object by disposing the instance first. + */ + dispose() { + + this.subscribe( + Event.INSTANCE_DISPOSED, + function(object) { + if (object === this) { + this.emit(Event.DISPOSE_OBJECT, this); + } + } + ); + + this.disposeInstance(); + + } + + /** + * disposeInstance() + * - Disposes of the runtime instance. + */ + disposeInstance() { + + console.log('Disposing instance of ' + this.name); + this.emit(Event.DISPOSE_INSTANCE, this); + + } + + /** + * setRuntime() + * - Sets the runtime property of this component required for constructing an instance of this component. + */ + setRuntime() { + + this.emit( + Event.GET_RUNTIME, + this, + function(runtime) { + this.runtime = runtime; + }.bind(this) + ) + + } + +} + +Component.DOM = 0x0; +Component.CANVAS = 0x1; +Component.GRAPHICS = 0x2; +Component.IMAGE = 0x3; +Component.MATERIAL = 0x4; +Component.MESH = 0x5; +Component.TEXTURE = 0x6; +Component.INPUT = 0x7; +Component.TOUCH = 0x8; +Component.MAX_COMPONENT = 0x9; + +/** + + Class R3.Event.Object.Component.DOM + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentDOM] + + Properties: + + - instance (Default value null - Holds the current instance of this object as determined (built) by + the runtime object.) + + Static Properties: + + + + Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.DOM_COMPONENT_INITIALIZED + + Static Methods: + + + + **/ + +class ComponentDOM extends Component { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + if (property === 'instance') { + this.instance.instance = this.instance; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'instance', + instanceProperty : 'instance' + } + ); + if (property !== 'all') { + return; + } + } + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + if (property === 'instance' || property === 'all') { + this.instance = this.instance.instance; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'instance', + instanceProperty : 'instance' + } + ); + if (property !== 'all') { + return; + } + } + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + + /** + * initialize() + * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + * Event.DOM_COMPONENT_INITIALIZED + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this); + + } + +} + +/** + + Class R3.Event.Object.Component.DOM.Canvas + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentDOM] + + Inherited Properties: + + - instance (Default value null - Holds the current instance of this object as determined (built) by + the runtime object.) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.DOM_COMPONENT_INITIALIZED + + Inherited Static Methods: + + + + [Belonging to ComponentCanvas] + + Properties: + + - type (Default value 'canvas') + - width (Default value 500 - The initial width of the canvas (You can override it with CSS)) + - height (Default value 500 - The initial height of the canvas (You can override it with CSS)) + - style (Default value 'border:1px solid #000000;') + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentCanvas extends ComponentDOM { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + /** + * type - No comment + */ + if (typeof options.type === 'undefined') { + options.type = 'canvas'; + } + /** + * width - The initial width of the canvas (You can override it with CSS) + */ + if (typeof options.width === 'undefined') { + options.width = 500; + } + /** + * height - The initial height of the canvas (You can override it with CSS) + */ + if (typeof options.height === 'undefined') { + options.height = 500; + } + /** + * style - No comment + */ + if (typeof options.style === 'undefined') { + options.style = 'border:1px solid #000000;'; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + if (property === 'width') { + this.instance.width = this.width; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'width', + instanceProperty : 'width' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'height') { + this.instance.height = this.height; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'height', + instanceProperty : 'height' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'style') { + this.instance.style = this.style; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'style', + instanceProperty : 'style' + } + ); + if (property !== 'all') { + return; + } + } + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + if (property === 'width' || property === 'all') { + this.width = this.instance.width; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'width', + instanceProperty : 'width' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'height' || property === 'all') { + this.height = this.instance.height; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'height', + instanceProperty : 'height' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'style' || property === 'all') { + this.style = this.instance.style; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'style', + instanceProperty : 'style' + } + ); + if (property !== 'all') { + return; + } + } + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphics] + + Properties: + + + + Static Properties: + + + + Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.GRAPHICS_COMPONENT_INITIALIZED + + Static Methods: + + + + **/ + +class ComponentGraphics extends Component { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + + /** + * initialize() + * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + * Event.GRAPHICS_COMPONENT_INITIALIZED + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Image + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.GRAPHICS_COMPONENT_INITIALIZED + + Inherited Static Methods: + + + + [Belonging to ComponentImage] + + Properties: + + - fileName (Default value Utils.LowerUnderscore(options.name) - Name of the image under which it is + stored) + - extension (Default value '.unknown' - Extension of the file name including the '.' (ex. '.jpg')) + - path (Default value '/' - Path on the server to the file, excluding filename) + - contentType (Default value 'application/octet-stream' - Content type of the file (based on the + extension, ex. 'image/jpeg')) + - size (Default value 0 - Size of the file in bytes) + - width (Default value 0 - Width of the image in pixels) + - height (Default value 0 - height of the image in pixels) + - orientation (Default value 'square' - The orientation of the image, one of 'square', 'landscape', + 'portrait') + + Static Properties: + + + + Methods: + + - initialize() + Also raises Event.IMAGE_INITIALIZED + + Static Methods: + + + + **/ + +class ComponentImage extends ComponentGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + /** + * fileName - Name of the image under which it is stored + */ + if (typeof options.fileName === 'undefined') { + options.fileName = Utils.LowerUnderscore(options.name); + } + /** + * extension - Extension of the file name including the '.' (ex. '.jpg') + */ + if (typeof options.extension === 'undefined') { + options.extension = '.unknown'; + } + /** + * path - Path on the server to the file, excluding filename + */ + if (typeof options.path === 'undefined') { + options.path = '/'; + } + /** + * contentType - Content type of the file (based on the extension, ex. 'image/jpeg') + */ + if (typeof options.contentType === 'undefined') { + options.contentType = 'application/octet-stream'; + } + /** + * size - Size of the file in bytes + */ + if (typeof options.size === 'undefined') { + options.size = 0; + } + /** + * width - Width of the image in pixels + */ + if (typeof options.width === 'undefined') { + options.width = 0; + } + /** + * height - height of the image in pixels + */ + if (typeof options.height === 'undefined') { + options.height = 0; + } + /** + * orientation - The orientation of the image, one of 'square', 'landscape', 'portrait' + */ + if (typeof options.orientation === 'undefined') { + options.orientation = 'square'; + } + + if (options.extension.match(/(png)$/i)) { + options.contentType = 'image/png'; + } + + if (options.extension.match(/(jpg|jpeg)$/i)) { + options.contentType = 'image/jpeg'; + } + + if (options.extension.match(/(gif)$/i)) { + options.contentType = 'image/gif'; + } + + Object.assign(this, options); + + if (this.width > this.height) { + this.orientation = 'landscape'; + } + + if (this.width < this.height) { + this.orientation = 'portrait'; + } + + if (this.width === this.height) { + this.orientation = 'square'; + } + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + if (property === 'size') { + this.instance.size = this.size; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'size', + instanceProperty : 'size' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'width') { + this.instance.width = this.width; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'width', + instanceProperty : 'width' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'height') { + this.instance.height = this.height; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'height', + instanceProperty : 'height' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'orientation') { + this.instance.orientation = this.orientation; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'orientation', + instanceProperty : 'orientation' + } + ); + if (property !== 'all') { + return; + } + } + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + if (property === 'size' || property === 'all') { + this.size = this.instance.size; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'size', + instanceProperty : 'size' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'width' || property === 'all') { + this.width = this.instance.width; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'width', + instanceProperty : 'width' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'height' || property === 'all') { + this.height = this.instance.height; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'height', + instanceProperty : 'height' + } + ); + if (property !== 'all') { + return; + } + } + if (property === 'orientation' || property === 'all') { + this.orientation = this.instance.orientation; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'orientation', + instanceProperty : 'orientation' + } + ); + if (property !== 'all') { + return; + } + } + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + + /** + * initialize() + * - Also raises Event.IMAGE_INITIALIZED + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this); + Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Material + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.GRAPHICS_COMPONENT_INITIALIZED + + Inherited Static Methods: + + + + [Belonging to ComponentMaterial] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentMaterial extends ComponentGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Mesh + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.GRAPHICS_COMPONENT_INITIALIZED + + Inherited Static Methods: + + + + [Belonging to ComponentMesh] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentMesh extends ComponentGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Texture + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.GRAPHICS_COMPONENT_INITIALIZED + + Inherited Static Methods: + + + + [Belonging to ComponentTexture] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentTexture extends ComponentGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Input + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentInput] + + Properties: + + + + Static Properties: + + + + Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.INPUT_COMPONENT_INITIALIZED + + Static Methods: + + + + **/ + +class ComponentInput extends Component { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + + /** + * initialize() + * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + * Event.INPUT_COMPONENT_INITIALIZED + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.COMPONENT_INITIALIZED, this); + Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Input.Touch + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentInput] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an + Event.INPUT_COMPONENT_INITIALIZED + + Inherited Static Methods: + + + + [Belonging to ComponentTouch] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentTouch extends ComponentInput { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + /** + * parent - The parent R3.Object of this component + */ + if (typeof options.parent === 'undefined') { + options.parent = null; + } + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Project + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely + identifies it everywhere (client and server side)) + - name (Default value 'Object ' + options.id - Each Object has a name) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raises an event(s) which indicates that this object initialized + + Inherited Static Methods: + + + + [Belonging to Project] + + Properties: + + + + Static Properties: + + + + Methods: + + - initialize() + Overrides for R3.Event.R3Object.initialize() + + Static Methods: + + + + **/ + +class Project extends R3Object { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Should raises an event(s) which indicates that this object initialized + */ + initialize() { + + if (this.initialized) { + console.warn('Multiple calls to initialize() - check your callstack'); + } else { + delete this.callDepth; + this.initialized = true; + } + + Event.Emit(Event.OBJECT_INITIALIZED, this); + Event.Emit(Event.PROJECT_INITIALIZED, this); + + } + +} + class Utils { constructor(options) { @@ -1604,4731 +6325,6 @@ class Utils { } -class RuntimeCoder extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.CODE_MIRROR = 0x8; - -class RuntimeDOM extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.DOCUMENT = 0x9; - -class RuntimeGUI extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.CONTROL_KIT = 0xa; - -class RuntimeGraphics extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.THREE = 0xb; - -class RuntimeImage extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.NODE_JS_IMAGE = 0xc; -Runtime.WEB_IMAGE = 0xd; - -class RuntimePhysics extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.BULLET = 0xe; - -class RuntimeSocket extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -class RuntimeStatistics extends Runtime { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - } - -} - -Runtime.STATS = 0xf; - -/** - - Class R3.System.DOM - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemDOM] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class SystemDOM extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'] = Event.Subscribe( - Event.DOM_COMPONENT_INITIALIZED, - SystemDOM.OnDomComponentInitialized - ); - - SystemDOM.Started = true; - - console.log('Started system: SystemDOM'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED'].remove(); - delete SystemDOM.Subscriptions['DOM_COMPONENT_INITIALIZED']; - - SystemDOM.Started = false; - - console.log('Stopped system: SystemDOM'); - - } - - /** - * OnDomComponentInitialized() - * - Listens to events of type Event.DOM_COMPONENT_INITIALIZED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnDomComponentInitialized(object) { - - object.createInstance(); - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemDOM.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemDOM.Subscriptions = {}; - -/** - - Class R3.System.Input - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemInput] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class SystemInput extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemInput.Subscriptions['TOUCH_START'] = Event.Subscribe( - Event.TOUCH_START, - SystemInput.OnTouchStart - ); - - SystemInput.Subscriptions['TOUCH_END'] = Event.Subscribe( - Event.TOUCH_END, - SystemInput.OnTouchEnd - ); - - SystemInput.Subscriptions['TOUCH_MOVE'] = Event.Subscribe( - Event.TOUCH_MOVE, - SystemInput.OnTouchMove - ); - - SystemInput.Subscriptions['TOUCH_CANCEL'] = Event.Subscribe( - Event.TOUCH_CANCEL, - SystemInput.OnTouchCancel - ); - - SystemInput.Subscriptions['KEYBOARD_DOWN'] = Event.Subscribe( - Event.KEYBOARD_DOWN, - SystemInput.OnKeyboardDown - ); - - SystemInput.Subscriptions['KEYBOARD_UP'] = Event.Subscribe( - Event.KEYBOARD_UP, - SystemInput.OnKeyboardUp - ); - - SystemInput.Subscriptions['MOUSE_DOWN'] = Event.Subscribe( - Event.MOUSE_DOWN, - SystemInput.OnMouseDown - ); - - SystemInput.Subscriptions['MOUSE_UP'] = Event.Subscribe( - Event.MOUSE_UP, - SystemInput.OnMouseUp - ); - - SystemInput.Subscriptions['MOUSE_MOVE'] = Event.Subscribe( - Event.MOUSE_MOVE, - SystemInput.OnMouseMove - ); - - SystemInput.Subscriptions['MOUSE_WHEEL'] = Event.Subscribe( - Event.MOUSE_WHEEL, - SystemInput.OnMouseWheel - ); - - SystemInput.Started = true; - - console.log('Started system: SystemInput'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemInput.Subscriptions['TOUCH_START'].remove(); - delete SystemInput.Subscriptions['TOUCH_START']; - - SystemInput.Subscriptions['TOUCH_END'].remove(); - delete SystemInput.Subscriptions['TOUCH_END']; - - SystemInput.Subscriptions['TOUCH_MOVE'].remove(); - delete SystemInput.Subscriptions['TOUCH_MOVE']; - - SystemInput.Subscriptions['TOUCH_CANCEL'].remove(); - delete SystemInput.Subscriptions['TOUCH_CANCEL']; - - SystemInput.Subscriptions['KEYBOARD_DOWN'].remove(); - delete SystemInput.Subscriptions['KEYBOARD_DOWN']; - - SystemInput.Subscriptions['KEYBOARD_UP'].remove(); - delete SystemInput.Subscriptions['KEYBOARD_UP']; - - SystemInput.Subscriptions['MOUSE_DOWN'].remove(); - delete SystemInput.Subscriptions['MOUSE_DOWN']; - - SystemInput.Subscriptions['MOUSE_UP'].remove(); - delete SystemInput.Subscriptions['MOUSE_UP']; - - SystemInput.Subscriptions['MOUSE_MOVE'].remove(); - delete SystemInput.Subscriptions['MOUSE_MOVE']; - - SystemInput.Subscriptions['MOUSE_WHEEL'].remove(); - delete SystemInput.Subscriptions['MOUSE_WHEEL']; - - SystemInput.Started = false; - - console.log('Stopped system: SystemInput'); - - } - - /** - * OnTouchStart() - * - Listens to events of type Event.TOUCH_START and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnTouchStart(object) { - - } - - /** - * OnTouchEnd() - * - Listens to events of type Event.TOUCH_END and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnTouchEnd(object) { - - } - - /** - * OnTouchMove() - * - Listens to events of type Event.TOUCH_MOVE and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnTouchMove(object) { - - } - - /** - * OnTouchCancel() - * - Listens to events of type Event.TOUCH_CANCEL and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnTouchCancel(object) { - - } - - /** - * OnKeyboardDown() - * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnKeyboardDown(object) { - - } - - /** - * OnKeyboardUp() - * - Listens to events of type Event.KEYBOARD_UP and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnKeyboardUp(object) { - - } - - /** - * OnMouseDown() - * - Listens to events of type Event.MOUSE_DOWN and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnMouseDown(object) { - - } - - /** - * OnMouseUp() - * - Listens to events of type Event.MOUSE_UP and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnMouseUp(object) { - - } - - /** - * OnMouseMove() - * - Listens to events of type Event.MOUSE_MOVE and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnMouseMove(object) { - - } - - /** - * OnMouseWheel() - * - Listens to events of type Event.MOUSE_WHEEL and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnMouseWheel(object) { - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemInput.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemInput.Subscriptions = {}; - -/** - - Class R3.System.Linking - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemLinking] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class SystemLinking extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemLinking.Subscriptions['OBJECT_CREATED'] = Event.Subscribe( - Event.OBJECT_CREATED, - SystemLinking.OnObjectCreated - ); - - SystemLinking.Subscriptions['OBJECT_INITIALIZED'] = Event.Subscribe( - Event.OBJECT_INITIALIZED, - SystemLinking.OnObjectInitialized - ); - - SystemLinking.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( - Event.INSTANCE_CREATED, - SystemLinking.OnInstanceCreated - ); - - SystemLinking.Started = true; - - console.log('Started system: SystemLinking'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemLinking.Subscriptions['OBJECT_CREATED'].remove(); - delete SystemLinking.Subscriptions['OBJECT_CREATED']; - - SystemLinking.Subscriptions['OBJECT_INITIALIZED'].remove(); - delete SystemLinking.Subscriptions['OBJECT_INITIALIZED']; - - SystemLinking.Subscriptions['INSTANCE_CREATED'].remove(); - delete SystemLinking.Subscriptions['INSTANCE_CREATED']; - - SystemLinking.Started = false; - - console.log('Stopped system: SystemLinking'); - - } - - /** - * OnObjectCreated() - * - Listens to events of type Event.OBJECT_CREATED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnObjectCreated(object) { - - console.log('Object Created'); - - } - - /** - * OnObjectInitialized() - * - Listens to events of type Event.OBJECT_INITIALIZED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnObjectInitialized(object) { - - console.log('Object Initialized : ' + object.constructor.name); - - } - - /** - * OnInstanceCreated() - * - Listens to events of type Event.INSTANCE_CREATED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnInstanceCreated(object) { - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemLinking.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemLinking.Subscriptions = {}; - -/** - - Class R3.System.Render - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemRender] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class SystemRender extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemRender.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( - Event.INSTANCE_CREATED, - SystemRender.OnInstanceCreated - ); - - SystemRender.Started = true; - - console.log('Started system: SystemRender'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemRender.Subscriptions['INSTANCE_CREATED'].remove(); - delete SystemRender.Subscriptions['INSTANCE_CREATED']; - - SystemRender.Started = false; - - console.log('Stopped system: SystemRender'); - - } - - /** - * OnInstanceCreated() - * - Listens to events of type Event.INSTANCE_CREATED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnInstanceCreated(object) { - - if (object instanceof R3.Component.DOM) { - if (object.runtime instanceof R3.Runtime.DOM.Document) { - document.body.appendChild(object.instance); - } - } - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemRender.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemRender.Subscriptions = {}; - -/** - - Class R3.System.Runtime - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemRuntime] - - Properties: - - - - Static Properties: - - - Projects (Default value []) - - CurrentProject (Default value null) - - RuntimeCoder (Default value {}) - - RuntimeDOM (Default value {}) - - RuntimeGUI (Default value {}) - - RuntimeGraphics (Default value {}) - - RuntimePhysics (Default value {}) - - RuntimeStatistics (Default value {}) - - Methods: - - - - Static Methods: - - - - **/ - -class SystemRuntime extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemRuntime.Subscriptions['GET_RUNTIME'] = Event.Subscribe( - Event.GET_RUNTIME, - SystemRuntime.OnGetRuntime - ); - - SystemRuntime.Subscriptions['PROJECT_INITIALIZED'] = Event.Subscribe( - Event.PROJECT_INITIALIZED, - SystemRuntime.OnProjectInitialized - ); - - SystemRuntime.Started = true; - - console.log('Started system: SystemRuntime'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemRuntime.Subscriptions['GET_RUNTIME'].remove(); - delete SystemRuntime.Subscriptions['GET_RUNTIME']; - - SystemRuntime.Subscriptions['PROJECT_INITIALIZED'].remove(); - delete SystemRuntime.Subscriptions['PROJECT_INITIALIZED']; - - SystemRuntime.Started = false; - - console.log('Stopped system: SystemRuntime'); - - } - - /** - * OnGetRuntime() - * - Listens to events of type Event.GET_RUNTIME and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnGetRuntime(object) { - - if (object instanceof R3.Component.DOM) { - - return new R3.Runtime.DOM.Document(); - - if (SystemRuntime.CurrentProject === null) { - console.log('There currently is no active project - using the default DOM runtime'); - } else { - console.log('TODO: implement a project based DOM runtime'); - } - } - - } - - /** - * OnProjectInitialized() - * - Listens to events of type Event.PROJECT_INITIALIZED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnProjectInitialized(object) { - - Utils.PushUnique(SystemRuntime.Projects, object); - SystemRuntime.CurrentProject = object; - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemRuntime.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemRuntime.Subscriptions = {}; - -/** - * static Projects - No comment - */ -SystemRuntime.Projects = []; - -/** - * static CurrentProject - No comment - */ -SystemRuntime.CurrentProject = null; - -/** - * static RuntimeCoder - No comment - */ -SystemRuntime.RuntimeCoder = {}; - -/** - * static RuntimeDOM - No comment - */ -SystemRuntime.RuntimeDOM = {}; - -/** - * static RuntimeGUI - No comment - */ -SystemRuntime.RuntimeGUI = {}; - -/** - * static RuntimeGraphics - No comment - */ -SystemRuntime.RuntimeGraphics = {}; - -/** - * static RuntimePhysics - No comment - */ -SystemRuntime.RuntimePhysics = {}; - -/** - * static RuntimeStatistics - No comment - */ -SystemRuntime.RuntimeStatistics = {}; - -/** - - Class R3.System.Socket - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemSocket] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class SystemSocket extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemSocket.Started = true; - - console.log('Started system: SystemSocket'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemSocket.Started = false; - - console.log('Stopped system: SystemSocket'); - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemSocket.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemSocket.Subscriptions = {}; - -/** - - Class R3.System.Storage - [Inherited from System] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to SystemStorage] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class SystemStorage extends System { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * Start() - * - Starts the system by registering subscriptions to events - * @param options - */ - static Start(options) { - - SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'] = Event.Subscribe( - Event.IMAGE_COMPONENT_INITIALIZED, - SystemStorage.OnImageComponentInitialized - ); - - SystemStorage.Started = true; - - console.log('Started system: SystemStorage'); - - } - - /** - * Stop() - * - Stops the system by removing these subscriptions to events - * @param options - */ - static Stop(options) { - - SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'].remove(); - delete SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED']; - - SystemStorage.Started = false; - - console.log('Stopped system: SystemStorage'); - - } - - /** - * OnImageComponentInitialized() - * - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function. - * @param object (The event data passed as argument - typically an R3Object) - * @return null - */ - static OnImageComponentInitialized(object) { - - object.createInstance(); - - } - -} - -/** - * static Started - Indicates whether or not this system is running or not - */ -SystemStorage.Started = false; - -/** - * static Subscriptions - An association object which hold the subscription handles for Events this system is listening - * to. The system can stop receiving events by calling remove() on a handle. - */ -SystemStorage.Subscriptions = {}; - -/** - - Class R3.Event.Object - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Belonging to R3Object] - - Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Static Properties: - - - - Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Static Methods: - - - - **/ - -class R3Object extends Event { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * id - Each Object receives an 10 digit random ID which uniquely identifies it everywhere (client and - * server side) - */ - if (typeof options.id === 'undefined') { - options.id = Utils.RandomId(10); - } - /** - * name - Each Object has a name - */ - if (typeof options.name === 'undefined') { - options.name = 'Object ' + options.id; - } - /** - * register - No comment - */ - if (typeof options.register === 'undefined') { - options.register = true; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Should raises an event(s) which indicates that this object initialized - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - - } - -} - -/** - - Class R3.Runtime.Coder.CodeMirror - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeCoder] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeCodeMirror] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeCodeMirror extends RuntimeCoder { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Runtime.DOM.Document - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeDOM] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeDocument] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeDocument extends RuntimeDOM { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - if (component instanceof R3.Component.DOM.Canvas) { - let canvas = document.createElement('canvas'); - canvas.setAttribute('width', component.width); - canvas.setAttribute('height', component.height); - canvas.setAttribute('style', component.style); - return canvas; - } - - } - -} - -/** - - Class R3.Runtime.GUI.ControlKit - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeGUI] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeControlKit] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeControlKit extends RuntimeGUI { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Runtime.Graphics.Three - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeGraphics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeThree] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeThree extends RuntimeGraphics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Runtime.Image.NodeJSImage - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeImage] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeNodeJSImage] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeNodeJSImage extends RuntimeImage { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Runtime.Image.WebImage - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeImage] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeWebImage] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeWebImage extends RuntimeImage { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Runtime.Physics.Bullet - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimePhysics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeBullet] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeBullet extends RuntimePhysics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Runtime.Statistics.Stats - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeStatistics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeStats] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeStats extends RuntimeStatistics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates an instance of R3.Component based on this Runtime. - * @param component - */ - buildInstance(component) { - - } - -} - -/** - - Class R3.Event.Object.Entity - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Belonging to Entity] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class Entity extends R3Object { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - this.emit(Event.ENTITY_CREATED, this); - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Should raises an event(s) which indicates that this object initialized - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.ENTITY_INITIALIZED, this); - - } - -} - -Entity.ENTITY_SLIDER = 0x0; -Entity.MAX_ENTITY = 0x1; - -/** - - Class R3.Event.Object.Component - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Belonging to Component] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class Component extends R3Object { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - this.emit(Event.COMPONENT_CREATED, this); - - /** - * register - No comment - */ - if (typeof options.register === 'undefined') { - options.register = true; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Should raises an event(s) which indicates that this object initialized - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.COMPONENT_INITIALIZED, this); - - } - - /** - * createInstance() - * - Creates an instance of this object based on the current runtime - */ - createInstance() { - - this.emit(Event.CREATE_INSTANCE_BEFORE, this); - - this.setRuntime(); - - this.instance = this.runtime.buildInstance(this); - - this.emit(Event.INSTANCE_CREATED, this); - - } - - /** - * dispose() - * - Disposes of this object by disposing the instance first. - */ - dispose() { - - this.subscribe( - Event.INSTANCE_DISPOSED, - function(object) { - if (object === this) { - this.emit(Event.DISPOSE_OBJECT, this); - } - } - ); - - this.disposeInstance(); - - } - - /** - * disposeInstance() - * - Disposes of the runtime instance. - */ - disposeInstance() { - - console.log('Disposing instance of ' + this.name); - this.emit(Event.DISPOSE_INSTANCE, this); - - } - - /** - * setRuntime() - * - Sets the runtime property of this component required for constructing an instance of this component. - */ - setRuntime() { - - this.emit( - Event.GET_RUNTIME, - this, - function(runtime) { - this.runtime = runtime; - }.bind(this) - ) - - } - -} - -Component.COMPONENT_DOM = 0x0; -Component.COMPONENT_CANVAS = 0x1; -Component.COMPONENT_GRAPHICS = 0x2; -Component.COMPONENT_IMAGE = 0x3; -Component.COMPONENT_MATERIAL = 0x4; -Component.COMPONENT_MESH = 0x5; -Component.COMPONENT_TEXTURE = 0x6; -Component.COMPONENT_INPUT = 0x7; -Component.COMPONENT_TOUCH = 0x8; -Component.MAX_COMPONENT = 0x9; - -/** - - Class R3.Event.Object.Project - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Belonging to Project] - - Properties: - - - - Static Properties: - - - - Methods: - - - initialize() - Overrides for R3.Event.R3Object.initialize() - - Static Methods: - - - - **/ - -class Project extends R3Object { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Should raises an event(s) which indicates that this object initialized - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.PROJECT_INITIALIZED, this); - - } - -} - -/** - - Class R3.Event.Object.Entity.Slider - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Entity] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to EntitySlider] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class EntitySlider extends Entity { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * components - A list of components that this entity is composed of - */ - if (typeof options.components === 'undefined') { - options.components = []; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - -} - -/** - - Class R3.Event.Object.Component.DOM - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentDOM] - - Properties: - - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) - - Static Properties: - - - - Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.DOM_COMPONENT_INITIALIZED - - Static Methods: - - - - **/ - -class ComponentDOM extends Component { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - if (property === 'instance') { - this.instance.instance = this.instance; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'instance', - instanceProperty : 'instance' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - if (property === 'instance' || property === 'all') { - this.instance = this.instance.instance; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'instance', - instanceProperty : 'instance' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - - /** - * initialize() - * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - * Event.DOM_COMPONENT_INITIALIZED - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.COMPONENT_INITIALIZED, this); - Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentGraphics] - - Properties: - - - - Static Properties: - - - - Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.GRAPHICS_COMPONENT_INITIALIZED - - Static Methods: - - - - **/ - -class ComponentGraphics extends Component { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - - /** - * initialize() - * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - * Event.GRAPHICS_COMPONENT_INITIALIZED - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.COMPONENT_INITIALIZED, this); - Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Input - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentInput] - - Properties: - - - - Static Properties: - - - - Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.INPUT_COMPONENT_INITIALIZED - - Static Methods: - - - - **/ - -class ComponentInput extends Component { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - - /** - * initialize() - * - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - * Event.INPUT_COMPONENT_INITIALIZED - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.COMPONENT_INITIALIZED, this); - Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this); - - } - -} - -/** - - Class R3.Event.Object.Component.DOM.Canvas - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentDOM] - - Inherited Properties: - - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.DOM_COMPONENT_INITIALIZED - - Inherited Static Methods: - - - - [Belonging to ComponentCanvas] - - Properties: - - - type (Default value 'canvas') - - width (Default value 500 - The initial width of the canvas (You can override it with CSS)) - - height (Default value 500 - The initial height of the canvas (You can override it with CSS)) - - style (Default value 'border:1px solid #000000;') - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentCanvas extends ComponentDOM { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - /** - * type - No comment - */ - if (typeof options.type === 'undefined') { - options.type = 'canvas'; - } - /** - * width - The initial width of the canvas (You can override it with CSS) - */ - if (typeof options.width === 'undefined') { - options.width = 500; - } - /** - * height - The initial height of the canvas (You can override it with CSS) - */ - if (typeof options.height === 'undefined') { - options.height = 500; - } - /** - * style - No comment - */ - if (typeof options.style === 'undefined') { - options.style = 'border:1px solid #000000;'; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - if (property === 'width') { - this.instance.width = this.width; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'width', - instanceProperty : 'width' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'height') { - this.instance.height = this.height; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'height', - instanceProperty : 'height' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'style') { - this.instance.style = this.style; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'style', - instanceProperty : 'style' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - if (property === 'width' || property === 'all') { - this.width = this.instance.width; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'width', - instanceProperty : 'width' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'height' || property === 'all') { - this.height = this.instance.height; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'height', - instanceProperty : 'height' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'style' || property === 'all') { - this.style = this.instance.style; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'style', - instanceProperty : 'style' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics.Image - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGraphics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.GRAPHICS_COMPONENT_INITIALIZED - - Inherited Static Methods: - - - - [Belonging to ComponentImage] - - Properties: - - - fileName (Default value Utils.LowerUnderscore(options.name) - Name of the image under which it is - stored) - - extension (Default value '.unknown' - Extension of the file name including the '.' (ex. '.jpg')) - - path (Default value '/' - Path on the server to the file, excluding filename) - - contentType (Default value 'application/octet-stream' - Content type of the file (based on the - extension, ex. 'image/jpeg')) - - size (Default value 0 - Size of the file in bytes) - - width (Default value 0 - Width of the image in pixels) - - height (Default value 0 - height of the image in pixels) - - orientation (Default value 'square' - The orientation of the image, one of 'square', 'landscape', - 'portrait') - - Static Properties: - - - - Methods: - - - initialize() - Also raises Event.IMAGE_INITIALIZED - - Static Methods: - - - - **/ - -class ComponentImage extends ComponentGraphics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - /** - * fileName - Name of the image under which it is stored - */ - if (typeof options.fileName === 'undefined') { - options.fileName = Utils.LowerUnderscore(options.name); - } - /** - * extension - Extension of the file name including the '.' (ex. '.jpg') - */ - if (typeof options.extension === 'undefined') { - options.extension = '.unknown'; - } - /** - * path - Path on the server to the file, excluding filename - */ - if (typeof options.path === 'undefined') { - options.path = '/'; - } - /** - * contentType - Content type of the file (based on the extension, ex. 'image/jpeg') - */ - if (typeof options.contentType === 'undefined') { - options.contentType = 'application/octet-stream'; - } - /** - * size - Size of the file in bytes - */ - if (typeof options.size === 'undefined') { - options.size = 0; - } - /** - * width - Width of the image in pixels - */ - if (typeof options.width === 'undefined') { - options.width = 0; - } - /** - * height - height of the image in pixels - */ - if (typeof options.height === 'undefined') { - options.height = 0; - } - /** - * orientation - The orientation of the image, one of 'square', 'landscape', 'portrait' - */ - if (typeof options.orientation === 'undefined') { - options.orientation = 'square'; - } - - if (options.extension.match(/(png)$/i)) { - options.contentType = 'image/png'; - } - - if (options.extension.match(/(jpg|jpeg)$/i)) { - options.contentType = 'image/jpeg'; - } - - if (options.extension.match(/(gif)$/i)) { - options.contentType = 'image/gif'; - } - - Object.assign(this, options); - - if (this.width > this.height) { - this.orientation = 'landscape'; - } - - if (this.width < this.height) { - this.orientation = 'portrait'; - } - - if (this.width === this.height) { - this.orientation = 'square'; - } - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - if (property === 'size') { - this.instance.size = this.size; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'size', - instanceProperty : 'size' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'width') { - this.instance.width = this.width; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'width', - instanceProperty : 'width' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'height') { - this.instance.height = this.height; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'height', - instanceProperty : 'height' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'orientation') { - this.instance.orientation = this.orientation; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'orientation', - instanceProperty : 'orientation' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - if (property === 'size' || property === 'all') { - this.size = this.instance.size; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'size', - instanceProperty : 'size' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'width' || property === 'all') { - this.width = this.instance.width; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'width', - instanceProperty : 'width' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'height' || property === 'all') { - this.height = this.instance.height; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'height', - instanceProperty : 'height' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'orientation' || property === 'all') { - this.orientation = this.instance.orientation; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'orientation', - instanceProperty : 'orientation' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - - /** - * initialize() - * - Also raises Event.IMAGE_INITIALIZED - */ - initialize() { - - if (this.initialized) { - console.warn('Multiple calls to initialize() - check your callstack'); - } else { - delete this.callDepth; - this.initialized = true; - } - - Event.Emit(Event.OBJECT_INITIALIZED, this); - Event.Emit(Event.COMPONENT_INITIALIZED, this); - Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this); - Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics.Material - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGraphics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.GRAPHICS_COMPONENT_INITIALIZED - - Inherited Static Methods: - - - - [Belonging to ComponentMaterial] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentMaterial extends ComponentGraphics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics.Mesh - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGraphics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.GRAPHICS_COMPONENT_INITIALIZED - - Inherited Static Methods: - - - - [Belonging to ComponentMesh] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentMesh extends ComponentGraphics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics.Texture - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGraphics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.GRAPHICS_COMPONENT_INITIALIZED - - Inherited Static Methods: - - - - [Belonging to ComponentTexture] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentTexture extends ComponentGraphics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Input.Touch - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely - identifies it everywhere (client and server side)) - - name (Default value 'Object ' + options.id - Each Object has a name) - - register (Default value true) - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - Should raises an event(s) which indicates that this object initialized - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentInput] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an - Event.INPUT_COMPONENT_INITIALIZED - - Inherited Static Methods: - - - - [Belonging to ComponentTouch] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentTouch extends ComponentInput { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.initialized === 'undefined') { - options.initialized = false; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - super(options); - - /** - * parent - The parent R3.Object of this component - */ - if (typeof options.parent === 'undefined') { - options.parent = null; - } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - Object.assign(this, options); - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -R3.Runtime = Runtime; -R3.System = System; -R3.Event = Event; -R3.Utils = Utils; -R3.Object = R3Object; -R3.Entity = Entity; -R3.Component = Component; -R3.Project = Project; -R3.DOM = ComponentDOM; -R3.Canvas = ComponentCanvas; -R3.Graphics = ComponentGraphics; -R3.Image = ComponentImage; -R3.Material = ComponentMaterial; -R3.Mesh = ComponentMesh; -R3.Texture = ComponentTexture; -R3.Input = ComponentInput; -R3.Touch = ComponentTouch; System.DOM = SystemDOM; System.Input = SystemInput; System.Linking = SystemLinking; @@ -6362,12 +6358,26 @@ Runtime.Socket = RuntimeSocket; Runtime.Statistics = RuntimeStatistics; Runtime.Statistics.Stats = RuntimeStats; Entity.Slider = EntitySlider; +R3.Runtime = Runtime; +R3.System = System; +R3.Event = Event; +R3.Utils = Utils; +R3.Object = R3Object; +R3.Entity = Entity; +R3.Component = Component; +R3.Project = Project; +R3.Canvas = Component.DOM.Canvas; +R3.Image = Component.Graphics.Image; +R3.Material = Component.Graphics.Material; +R3.Mesh = Component.Graphics.Mesh; +R3.Texture = Component.Graphics.Texture; +R3.Touch = Component.Input.Touch; console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); -SystemDOM.Start(); -SystemInput.Start(); -SystemLinking.Start(); -SystemRender.Start(); -SystemRuntime.Start(); -SystemSocket.Start(); -SystemStorage.Start(); +R3.System.DOM.Start(); +R3.System.Input.Start(); +R3.System.Linking.Start(); +R3.System.Render.Start(); +R3.System.Runtime.Start(); +R3.System.Socket.Start(); +R3.System.Storage.Start(); diff --git a/r3.php b/r3.php index 0d16dfe..b5abb42 100755 --- a/r3.php +++ b/r3.php @@ -1161,6 +1161,25 @@ function buildIndexBody($graph, $node, &$body, $nameSpace) } +function buildImportsAndBody(&$imports, &$body, $node, $type, $nameSpace) +{ + + $originalNameSpace = $nameSpace; + + foreach ($node->children as $child) { + + $nameSpace = $originalNameSpace . '.' . $child->nameSpaceClassName; + + $file = str_replace('src/r3/r3-' . strtolower($type), '.', $child->file); + array_push($imports, "const " . $child->name . ' = require(\'' . $file . "');"); + array_push($body, "$nameSpace = " . $child->name . ';'); + + $child->nameSpace = $nameSpace; + + buildImportsAndBody($imports, $body, $child, $type, $nameSpace); + } +} + function generateIndex($types) { /** @@ -1176,55 +1195,24 @@ function generateIndex($types) $body = []; $exports = []; - if ($type === 'Runtime') { - $nodes = $graph->walk(); + $nodes = $graph->walk(); - foreach ($nodes as $node) { + foreach ($nodes as $node) { - if (preg_match('/\bRuntime\b/', $node->name) && $node->isBaseClass) { + if (preg_match("/\b$type\b/", $node->name)) { - $file = str_replace('src/r3/r3-' . strtolower($type), '.', $node->file); + $file = str_replace('src/r3/r3-' . strtolower($type), '.', $node->file); - array_push($imports, "const " . $node->name . ' = require(\'' . $file . "');"); + array_push($imports, "const " . $node->name . ' = require(\'' . $file . "');"); - foreach ($node->children as $child) { - $file = str_replace('src/r3/r3-' . strtolower($type), '.', $child->file); - array_push($imports, "const " . $child->name . ' = require(\'' . $file . "');"); - array_push($body, 'Runtime.' . str_replace('Runtime', '', $child->name) . ' = ' . $child->name . ';'); - - foreach ($child->children as $implementation) { - $file = str_replace('src/r3/r3-' . strtolower($type), '.', $implementation->file); - array_push($imports, "const " . $implementation->name . ' = require(\'' . $file . "');"); -// array_push($body, 'Runtime.' . str_replace('Runtime', '', $implementation->name) . ' = ' . $implementation->name . ';'); - array_push($body, 'Runtime.' . str_replace('Runtime', '', $child->name) . '.' . str_replace('Runtime', '', $implementation->name) . ' = ' . $implementation->name . ';'); - } - } - } - } - - array_push($exports, 'module.exports = Runtime;'); - } else { - - $node = $graph->search('name', $type); - - $children = $graph->flatten($node); - - $nodes = array_merge([$node], $children); - - foreach ($nodes as $child) { - - $file = str_replace('src/r3/r3-' . strtolower($type), '.', $child->file); - - array_push($imports, "const " . $child->name . ' = require(\'' . $file . "');"); + buildImportsAndBody($imports, $body, $node, $type, $type); } - - buildIndexBody($graph, $node, $body, $node->nameSpaceClassName); - - array_push($exports, 'module.exports = ' . $node->name . ';'); } + array_push($exports, "module.exports = $type;"); + $indexFile = 'src/r3/r3-'. strtolower($type) . '/index.js'; file_put_contents($indexFile, $template); @@ -1269,7 +1257,9 @@ function generateR3($nodes, $graph) $children = $graph->flatten($component); foreach ($children as $child) { - array_push($defines, 'R3.' . $child->nameSpaceClassName . ' = ' . $child->name); + if (sizeof($child->children) === 0) { + array_push($defines, 'R3.' . $child->nameSpaceClassName . ' = ' . $child->nameSpace); + } } $r3File = 'src/r3/r3-r3.js'; @@ -1314,7 +1304,7 @@ function generateR3($nodes, $graph) * Node $node */ if (preg_match('/\bSystem\w+\b/', $node->name)){ - array_push($indexBody, $node->nameSpace . $node->nameSpaceClassName . ".Start();"); + array_push($indexBody, 'R3.' . $node->nameSpace . ".Start();"); } } @@ -1411,8 +1401,31 @@ function generateEvents() } +function writeSource($node, $file) +{ + foreach ($node->children as $child) { + $contents = file_get_contents($child->file); + fwrite($file, $contents); + writeSource($child, $file); + } +} + +function buildDefines(&$defines, $node, $nameSpace) +{ + $originalNameSpace = $nameSpace; + + foreach ($node->children as $child) { + $nameSpace = $originalNameSpace . '.' . $child->nameSpaceClassName; + array_push($defines, $nameSpace. ' = ' . $child->nameSpaceClassName); + buildDefines($defines, $child, $nameSpace); + } + +} + function generateR3Dist($nodes) { + global $graph; + $r3jsFile = 'dist/r3.js'; $r3jsSource = 'src/r3/r3-r3.js'; $r3jsBaseTemplate = 'src/templates/r3_base.template'; @@ -1434,25 +1447,15 @@ function generateR3Dist($nodes) $generateTokens = getTokens(['GENERATED']); $customTokens = getTokens(['CUSTOM']); - $savedGenerate = save($r3jsSource, $generateTokens)[1]; - $savedCustom = save($r3jsSource, $customTokens)[1]; + $r3 = $graph->search('name', 'R3'); - foreach ($nodes as $node) { - $contents = file_get_contents($node->file); - fwrite($r3js, $contents); - } + writeSource($r3, $r3js); - foreach ($savedGenerate as $key => $store) - { +// $defines = []; - if ($key === 'GENERATED_IMPORTS') { - continue; - } +// buildDefines($defines, $r3, "R3"); - foreach ($store as $line) { - fwrite($r3js, $line); - } - } +// fwrite($r3js, join("\n", $defines)); $indexFiles = [ 'src/r3/r3-system/index.js', @@ -1480,6 +1483,20 @@ function generateR3Dist($nodes) deleteSavedFile($indexFile . '.saved'); } + $savedGenerate = save($r3jsSource, $generateTokens)[1]; + $savedCustom = save($r3jsSource, $customTokens)[1]; + foreach ($savedGenerate as $key => $store) + { + + if ($key === 'GENERATED_IMPORTS') { + continue; + } + + foreach ($store as $line) { + fwrite($r3js, $line); + } + } + foreach ($savedCustom as $key => $store) { foreach ($store as $line) { @@ -1487,7 +1504,11 @@ function generateR3Dist($nodes) } } + + + $contents = file_get_contents('src/r3/index.js'); + fwrite($r3js, $contents); fclose($r3js); @@ -1537,13 +1558,6 @@ function generateR3Dist($nodes) */ $contents = preg_replace('/.*\b' . $customTokenKey . '(_START|_END)\b.*?\n/m', '', $contents ); } -// -// foreach ($templateTokens as $templateTokenKey => $templateTokenValue) { -// /** -// * Remove generate tokens -// */ -// $contents = preg_replace('/.*\b' . $templateTokenKey . '(_START|_END)\b.*?\n/m', '', $contents ); -// } $contents = preg_replace('/\n^\/\*\*\s+\*\*\/\s*?$/sm', '', $contents); @@ -1692,18 +1706,11 @@ function generateOutOfClassImplementationDefines($graph, $types) $i++; } - updateSection($parent->file, 'GENERATED_OUT_OF_CLASS_IMPLEMENTATION' , $updateList); - } - - if (preg_match('/\bRuntime\w+/', $node->name) && $node->parent->name === 'Runtime') { - - $parent = $node; - - $updateList = []; - foreach ($parent->children as $child) { - array_push($updateList, 'Runtime.' . strtoupper(from_camel_case(str_replace('Runtime','', $child->name))) . ' = 0x' . dechex($i) . ";\n"); - $i++; + foreach ($child->children as $implementation) { + array_push($updateList, 'Runtime.' . strtoupper(from_camel_case(str_replace('Runtime', '', $implementation->name))) . ' = 0x' . dechex($i) . ";\n"); + $i++; + } } updateSection($parent->file, 'GENERATED_OUT_OF_CLASS_IMPLEMENTATION' , $updateList); @@ -1722,7 +1729,7 @@ function generateOutOfClassImplementationDefines($graph, $types) $children = $graph->flatten($parent); foreach ($children as $child) { - array_push($updateList, $parent->name . '.' . strtoupper(from_camel_case($child->name)) . ' = 0x' . dechex($i) . ";\n"); + array_push($updateList, $parent->name . '.' . strtoupper(from_camel_case(str_replace($parent->name, '', $child->name))) . ' = 0x' . dechex($i) . ";\n"); $i++; } diff --git a/src/r3/index.js b/src/r3/index.js index 1c363ae..0e659d5 100644 --- a/src/r3/index.js +++ b/src/r3/index.js @@ -4,13 +4,13 @@ const R3 = require('r3-r3.js'); //GENERATED_INDEX_BODY_START console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); -SystemDOM.Start(); -SystemInput.Start(); -SystemLinking.Start(); -SystemRender.Start(); -SystemRuntime.Start(); -SystemSocket.Start(); -SystemStorage.Start(); +R3.System.DOM.Start(); +R3.System.Input.Start(); +R3.System.Linking.Start(); +R3.System.Render.Start(); +R3.System.Runtime.Start(); +R3.System.Socket.Start(); +R3.System.Storage.Start(); //GENERATED_INDEX_BODY_END //GENERATED_EXPORTS_START diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 2c6faf7..1d6637a 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -296,15 +296,15 @@ class Component extends R3Object { //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -Component.COMPONENT_DOM = 0x0; -Component.COMPONENT_CANVAS = 0x1; -Component.COMPONENT_GRAPHICS = 0x2; -Component.COMPONENT_IMAGE = 0x3; -Component.COMPONENT_MATERIAL = 0x4; -Component.COMPONENT_MESH = 0x5; -Component.COMPONENT_TEXTURE = 0x6; -Component.COMPONENT_INPUT = 0x7; -Component.COMPONENT_TOUCH = 0x8; +Component.DOM = 0x0; +Component.CANVAS = 0x1; +Component.GRAPHICS = 0x2; +Component.IMAGE = 0x3; +Component.MATERIAL = 0x4; +Component.MESH = 0x5; +Component.TEXTURE = 0x6; +Component.INPUT = 0x7; +Component.TOUCH = 0x8; Component.MAX_COMPONENT = 0x9; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END diff --git a/src/r3/r3-entity/r3-entity.js b/src/r3/r3-entity/r3-entity.js index c695fd5..0e77f65 100644 --- a/src/r3/r3-entity/r3-entity.js +++ b/src/r3/r3-entity/r3-entity.js @@ -202,7 +202,7 @@ class Entity extends R3Object { //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -Entity.ENTITY_SLIDER = 0x0; +Entity.SLIDER = 0x0; Entity.MAX_ENTITY = 0x1; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 19b6a9c..75afc83 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { static version = '2.0.758'; - static compileDate = '2021 Sep 18 - 08:48:43 am'; + static compileDate = '2021 Sep 18 - 11:04:13 am'; } //GENERATED_IMPORTS_START @@ -23,15 +23,12 @@ R3.Object = R3Object; R3.Entity = Entity; R3.Component = Component; R3.Project = Project; -R3.DOM = ComponentDOM; -R3.Canvas = ComponentCanvas; -R3.Graphics = ComponentGraphics; -R3.Image = ComponentImage; -R3.Material = ComponentMaterial; -R3.Mesh = ComponentMesh; -R3.Texture = ComponentTexture; -R3.Input = ComponentInput; -R3.Touch = ComponentTouch; +R3.Canvas = Component.DOM.Canvas; +R3.Image = Component.Graphics.Image; +R3.Material = Component.Graphics.Material; +R3.Mesh = Component.Graphics.Mesh; +R3.Texture = Component.Graphics.Texture; +R3.Touch = Component.Input.Touch; //GENERATED_DEFINES_END //CUSTOM_CONVENIENT_DEFINES_START diff --git a/src/r3/r3-runtime/r3-runtime-coder.js b/src/r3/r3-runtime/r3-runtime-coder.js index 7003c84..9b72b85 100644 --- a/src/r3/r3-runtime/r3-runtime-coder.js +++ b/src/r3/r3-runtime/r3-runtime-coder.js @@ -74,7 +74,6 @@ class RuntimeCoder extends Runtime { //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -Runtime.CODE_MIRROR = 0x8; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index 4fe8939..a8bac58 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -93,6 +93,14 @@ Runtime.BASE_IMAGE = 0x4; Runtime.BASE_PHYSICS = 0x5; Runtime.BASE_SOCKET = 0x6; Runtime.BASE_STATISTICS = 0x7; +Runtime.CODE_MIRROR = 0x8; +Runtime.DOCUMENT = 0x9; +Runtime.CONTROL_KIT = 0xa; +Runtime.THREE = 0xb; +Runtime.NODE_JS_IMAGE = 0xc; +Runtime.WEB_IMAGE = 0xd; +Runtime.BULLET = 0xe; +Runtime.STATS = 0xf; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-system/r3-system-runtime.js b/src/r3/r3-system/r3-system-runtime.js index a087ae2..61738a5 100644 --- a/src/r3/r3-system/r3-system-runtime.js +++ b/src/r3/r3-system/r3-system-runtime.js @@ -224,14 +224,21 @@ class SystemRuntime extends System { //CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_START if (object instanceof R3.Component.DOM) { - return new R3.Runtime.DOM.Document(); - if (SystemRuntime.CurrentProject === null) { - console.log('There currently is no active project - using the default DOM runtime'); + return new R3.Runtime.DOM.Document(); } else { console.log('TODO: implement a project based DOM runtime'); } } + + if (object instanceof R3.Image) { + + if (SystemRuntime.CurrentProject === null) { + return new R3.Runtime.Image.WebImage(); + } else { + console.log('TODO: implement a project based Image runtime'); + } + } //CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_END } diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index fb0b154..faf50c3 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -89,13 +89,13 @@ class System { //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -System.SYSTEM_DOM = 0x0; -System.SYSTEM_INPUT = 0x1; -System.SYSTEM_LINKING = 0x2; -System.SYSTEM_RENDER = 0x3; -System.SYSTEM_RUNTIME = 0x4; -System.SYSTEM_SOCKET = 0x5; -System.SYSTEM_STORAGE = 0x6; +System.DOM = 0x0; +System.INPUT = 0x1; +System.LINKING = 0x2; +System.RENDER = 0x3; +System.RUNTIME = 0x4; +System.SOCKET = 0x5; +System.STORAGE = 0x6; System.MAX_SYSTEM = 0x7; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END