diff --git a/.r3_history b/.r3_history index df4c070..ce8a062 100644 --- a/.r3_history +++ b/.r3_history @@ -24,3 +24,5 @@ r3 create CodeMirror extends Coder ./r3-runtime/ r3 create Bullet extends Physics ./r3-runtime/ r3 create ControlKit extends GUI ./r3-runtime/ r3 create Stats extends Statistics ./r3-runtime/ +r3 create DOM extends Component ./r3-component/ +r3 create Canvas extends DOM ./r3-component/ diff --git a/dist/index.html b/dist/index.html index 271f2c7..37a2dd2 100644 --- a/dist/index.html +++ b/dist/index.html @@ -18,6 +18,12 @@ } })(); - + + diff --git a/dist/r3.js b/dist/r3.js index 6672f8c..a87209a 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.206'; - static compileDate = '2021 Sep 08 - 07:14:46 am'; + static version = '2.0.212'; + static compileDate = '2021 Sep 08 - 08:24:42 am'; } /** @@ -37,7 +37,7 @@ class System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -74,7 +74,7 @@ class Event { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -376,7 +376,7 @@ class Utils { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -1686,7 +1686,7 @@ class SystemInput extends System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -1827,100 +1827,100 @@ class SystemInput extends System { /** * OnTouchStart() * - Listens to events of type Event.TOUCH_START and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchStart(data) { + static OnTouchStart(object) { } /** * OnTouchEnd() * - Listens to events of type Event.TOUCH_END and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchEnd(data) { + static OnTouchEnd(object) { } /** * OnTouchMove() * - Listens to events of type Event.TOUCH_MOVE and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchMove(data) { + static OnTouchMove(object) { } /** * OnTouchCancel() * - Listens to events of type Event.TOUCH_CANCEL and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchCancel(data) { + static OnTouchCancel(object) { } /** * OnKeyboardDown() * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnKeyboardDown(data) { + static OnKeyboardDown(object) { } /** * OnKeyboardUp() * - Listens to events of type Event.KEYBOARD_UP and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnKeyboardUp(data) { + static OnKeyboardUp(object) { } /** * OnMouseDown() * - Listens to events of type Event.MOUSE_DOWN and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseDown(data) { + static OnMouseDown(object) { } /** * OnMouseUp() * - Listens to events of type Event.MOUSE_UP and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseUp(data) { + static OnMouseUp(object) { } /** * OnMouseMove() * - Listens to events of type Event.MOUSE_MOVE and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseMove(data) { + static OnMouseMove(object) { } /** * OnMouseWheel() * - Listens to events of type Event.MOUSE_WHEEL and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseWheel(data) { + static OnMouseWheel(object) { } @@ -1996,7 +1996,7 @@ class SystemLinking extends System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2042,6 +2042,11 @@ class SystemLinking extends System { SystemLinking.OnObjectCreated ); + SystemLinking.Subscriptions['OBJECT_INITIALIZED'] = Event.Subscribe( + Event.OBJECT_INITIALIZED, + SystemLinking.OnObjectInitialized + ); + SystemLinking.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( Event.INSTANCE_CREATED, SystemLinking.OnInstanceCreated @@ -2063,6 +2068,9 @@ class SystemLinking extends System { 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']; @@ -2075,20 +2083,34 @@ class SystemLinking extends System { /** * OnObjectCreated() * - Listens to events of type Event.OBJECT_CREATED and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnObjectCreated(data) { + static OnObjectCreated(object) { + + console.log('Object Created : ' + object.name); + + } + + /** + * 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 data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnInstanceCreated(data) { + static OnInstanceCreated(object) { } @@ -2164,7 +2186,7 @@ class SystemSocket extends System { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2308,7 +2330,7 @@ class Runtime extends Event { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2375,6 +2397,8 @@ Runtime.MAX_RUNTIMES = 0xc; Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Static Properties: @@ -2407,6 +2431,14 @@ class R3Object extends Event { super(options); + if (typeof options.id === 'undefined') { + options.id = Utils.RandomId(10); + } + + if (typeof options.name === 'undefined') { + options.name = 'Object ' + options.id; + } + if (typeof options.register === 'undefined') { options.register = true; } @@ -2414,7 +2446,7 @@ class R3Object extends Event { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2520,7 +2552,7 @@ class Coder extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2626,7 +2658,7 @@ class Default extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2732,7 +2764,7 @@ class GUI extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2838,7 +2870,7 @@ class Graphics extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -2944,7 +2976,7 @@ class Physics extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3050,7 +3082,7 @@ class Socket extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3156,7 +3188,7 @@ class Statistics extends Runtime { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3209,6 +3241,8 @@ class Statistics extends Runtime { Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -3275,7 +3309,7 @@ class Component extends R3Object { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3361,10 +3395,12 @@ class Component extends R3Object { } -Component.IMAGE = 0x0; -Component.INPUT = 0x1; -Component.TOUCH = 0x2; -Component.MAX_COMPONENTS = 0x3; +Component.DOM = 0x0; +Component.CANVAS = 0x1; +Component.IMAGE = 0x2; +Component.INPUT = 0x3; +Component.TOUCH = 0x4; +Component.MAX_COMPONENTS = 0x5; /** @@ -3409,6 +3445,8 @@ Component.MAX_COMPONENTS = 0x3; Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -3462,7 +3500,7 @@ class Project extends R3Object { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3586,7 +3624,7 @@ class CodeMirror extends Coder { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3710,7 +3748,7 @@ class ControlKit extends GUI { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3834,7 +3872,7 @@ class Three extends Graphics { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -3958,7 +3996,7 @@ class Bullet extends Physics { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -4082,7 +4120,146 @@ class Stats extends Statistics { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + } 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)) + - name (Default value 'Object ' + options.id) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - createInstance() + Creates an instance of this object based on the current runtime + + - dispose() + Disposes of this object by disposing the instance first. + + - disposeInstance() + Disposes of the runtime instance. + + - updateFromInstance() + Updates this object by copying the values of its instance into the current object. + + - getRuntime() + Gets the current runtime object + + Inherited Static Methods: + + + + [Belonging to DOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class DOM extends Component { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + Object.assign(this, options); + + if (options.callDepth === 0) { + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -4135,6 +4312,8 @@ class Stats extends Statistics { Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -4219,7 +4398,7 @@ class Image extends Component { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -4272,6 +4451,8 @@ class Image extends Component { Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -4356,7 +4537,7 @@ class Input extends Component { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -4367,6 +4548,163 @@ class Input extends Component { } +/** + + 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)) + - name (Default value 'Object ' + options.id) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - createInstance() + Creates an instance of this object based on the current runtime + + - dispose() + Disposes of this object by disposing the instance first. + + - disposeInstance() + Disposes of the runtime instance. + + - updateFromInstance() + Updates this object by copying the values of its instance into the current object. + + - getRuntime() + Gets the current runtime object + + Inherited Static Methods: + + + + [Inherited from DOM] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to Canvas] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class Canvas extends DOM { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + Object.assign(this, options); + + if (options.callDepth === 0) { + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + } else { + options.callDepth--; + } + + } + +} + /** Class R3.Event.Object.Component.Input.Touch @@ -4410,6 +4748,8 @@ class Input extends Component { Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -4512,7 +4852,7 @@ class Touch extends Input { Object.assign(this, options); if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -4529,9 +4869,16 @@ R3.Runtime = Runtime; R3.Object = R3Object; R3.Component = Component; R3.Project = Project; +R3.DOM = DOM; +R3.Canvas = Canvas; +R3.Image = Image; +R3.Input = Input; +R3.Touch = Touch; System.Input = SystemInput; System.Linking = SystemLinking; System.Socket = SystemSocket; +Component.DOM = DOM; +Component.DOM.Canvas = Canvas; Component.Image = Image; Component.Input = Input; Component.Input.Touch = Touch; diff --git a/package.json b/package.json index cca1c5f..7dd64b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.206", + "version" : "2.0.212", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index fde031d..2d915f3 100755 --- a/r3.php +++ b/r3.php @@ -991,7 +991,7 @@ function getStaticEventListenerUpdates($template, $tokens, $token) $updated = $template; - $methodArgs = 'data'; + $methodArgs = 'object'; $params = "\n * @param " . $methodArgs . " (The event data passed as argument - typically an R3Object)"; @@ -1154,6 +1154,14 @@ function generateR3($nodes, $graph) } + $component = $graph->search('name', 'Component'); + + $children = $graph->flatten($component); + + foreach ($children as $child) { + array_push($defines, 'R3.' . $child->nameSpaceClassName . ' = ' . $child->name); + } + $r3File = 'src/r3/r3-r3.js'; save($r3File, getTokens('CUSTOM')); diff --git a/src/r3/r3-component/index.js b/src/r3/r3-component/index.js index 03569dc..85f72f8 100644 --- a/src/r3/r3-component/index.js +++ b/src/r3/r3-component/index.js @@ -1,11 +1,15 @@ //GENERATED_IMPORTS_START const Component = require('./r3-component.js'); +const DOM = require('./r3-d-o-m.js'); +const Canvas = require('./r3-canvas.js'); const Image = require('./r3-image.js'); const Input = require('./r3-input.js'); const Touch = require('./r3-touch.js'); //GENERATED_IMPORTS_END //GENERATED_INDEX_BODY_START +Component.DOM = DOM; +Component.DOM.Canvas = Canvas; Component.Image = Image; Component.Input = Input; Component.Input.Touch = Touch; diff --git a/src/r3/r3-component/r3-canvas.js b/src/r3/r3-component/r3-canvas.js new file mode 100644 index 0000000..d04a8eb --- /dev/null +++ b/src/r3/r3-component/r3-canvas.js @@ -0,0 +1,211 @@ +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); +const DOM = require('.././r3-d-o-m.js'); + +/** + + GENERATED_INHERITED_START + + 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)) + - name (Default value 'Object ' + options.id) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - createInstance() + Creates an instance of this object based on the current runtime + + - dispose() + Disposes of this object by disposing the instance first. + + - disposeInstance() + Disposes of the runtime instance. + + - updateFromInstance() + Updates this object by copying the values of its instance into the current object. + + - getRuntime() + Gets the current runtime object + + Inherited Static Methods: + + + + [Inherited from DOM] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to Canvas] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_LINKED_OBJECTS_START + CUSTOM_LINKED_OBJECTS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class Canvas extends DOM { + + //GENERATED_CONSTRUCTOR_EXTENDS_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + if (options.callDepth === 0) { + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_EXTENDS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = Canvas; diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index db02e9e..679633a 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -47,6 +47,8 @@ const R3Object = require('.././r3-r3-object.js'); Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -148,7 +150,7 @@ class Component extends R3Object { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -277,10 +279,12 @@ class Component extends R3Object { } //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -Component.IMAGE = 0x0; -Component.INPUT = 0x1; -Component.TOUCH = 0x2; -Component.MAX_COMPONENTS = 0x3; +Component.DOM = 0x0; +Component.CANVAS = 0x1; +Component.IMAGE = 0x2; +Component.INPUT = 0x3; +Component.TOUCH = 0x4; +Component.MAX_COMPONENTS = 0x5; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-component/r3-d-o-m.js b/src/r3/r3-component/r3-d-o-m.js new file mode 100644 index 0000000..991d2b1 --- /dev/null +++ b/src/r3/r3-component/r3-d-o-m.js @@ -0,0 +1,193 @@ +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); +const Component = require('.././r3-component.js'); + +/** + + GENERATED_INHERITED_START + + 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)) + - name (Default value 'Object ' + options.id) + - register (Default value true) + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - createInstance() + Creates an instance of this object based on the current runtime + + - dispose() + Disposes of this object by disposing the instance first. + + - disposeInstance() + Disposes of the runtime instance. + + - updateFromInstance() + Updates this object by copying the values of its instance into the current object. + + - getRuntime() + Gets the current runtime object + + Inherited Static Methods: + + + + [Belonging to DOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_LINKED_OBJECTS_START + CUSTOM_LINKED_OBJECTS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class DOM extends Component { + + //GENERATED_CONSTRUCTOR_EXTENDS_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + if (options.callDepth === 0) { + Event.Emit(Event.OBJECT_INITIALIZED, this); + delete this.callDepth; + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_EXTENDS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = DOM; diff --git a/src/r3/r3-component/r3-image.js b/src/r3/r3-component/r3-image.js index 85e3ab4..2fffcfb 100644 --- a/src/r3/r3-component/r3-image.js +++ b/src/r3/r3-component/r3-image.js @@ -47,6 +47,8 @@ const Component = require('.././r3-component.js'); Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -161,7 +163,7 @@ class Image extends Component { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-component/r3-input.js b/src/r3/r3-component/r3-input.js index d0c460c..be73a37 100644 --- a/src/r3/r3-component/r3-input.js +++ b/src/r3/r3-component/r3-input.js @@ -47,6 +47,8 @@ const Component = require('.././r3-component.js'); Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -161,7 +163,7 @@ class Input extends Component { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-component/r3-touch.js b/src/r3/r3-component/r3-touch.js index 719eb05..a0407d2 100644 --- a/src/r3/r3-component/r3-touch.js +++ b/src/r3/r3-component/r3-touch.js @@ -47,6 +47,8 @@ const Input = require('.././r3-input.js'); Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -179,7 +181,7 @@ class Touch extends Input { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 72795a1..0ef2975 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -52,7 +52,7 @@ class Event { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-project.js b/src/r3/r3-project.js index 27fa99a..bc9bee6 100644 --- a/src/r3/r3-project.js +++ b/src/r3/r3-project.js @@ -47,6 +47,8 @@ const R3Object = require('./r3-r3-object.js'); Inherited Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Inherited Static Properties: @@ -130,7 +132,7 @@ class Project extends R3Object { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-r3-object.js b/src/r3/r3-r3-object.js index 4d161c7..596db5e 100644 --- a/src/r3/r3-r3-object.js +++ b/src/r3/r3-r3-object.js @@ -46,6 +46,8 @@ const Event = require('./r3-event.js'); Properties: + - id (Default value Utils.RandomId(10)) + - name (Default value 'Object ' + options.id) - register (Default value true) Static Properties: @@ -63,6 +65,8 @@ const Event = require('./r3-event.js'); GENERATED_INHERITED_END CUSTOM_OPTIONS_START + id=Utils.RandomId(10) + name='Object ' + options.id register=true CUSTOM_OPTIONS_END @@ -102,6 +106,14 @@ class R3Object extends Event { //GENERATED_OPTIONS_INIT_START + if (typeof options.id === 'undefined') { + options.id = Utils.RandomId(10); + } + + if (typeof options.name === 'undefined') { + options.name = 'Object ' + options.id; + } + if (typeof options.register === 'undefined') { options.register = true; } @@ -116,7 +128,7 @@ class R3Object extends Event { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 7c95adc..1bfcb06 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.206'; - static compileDate = '2021 Sep 08 - 07:14:46 am'; + static version = '2.0.212'; + static compileDate = '2021 Sep 08 - 08:24:42 am'; } //GENERATED_IMPORTS_START @@ -21,6 +21,11 @@ R3.Runtime = Runtime; R3.Object = R3Object; R3.Component = Component; R3.Project = Project; +R3.DOM = DOM; +R3.Canvas = Canvas; +R3.Image = Image; +R3.Input = Input; +R3.Touch = Touch; //GENERATED_DEFINES_END //CUSTOM_CONVENIENT_DEFINES_START diff --git a/src/r3/r3-runtime/r3-bullet.js b/src/r3/r3-runtime/r3-bullet.js index 52787b8..6a0a003 100644 --- a/src/r3/r3-runtime/r3-bullet.js +++ b/src/r3/r3-runtime/r3-bullet.js @@ -148,7 +148,7 @@ class Bullet extends Physics { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-code-mirror.js b/src/r3/r3-runtime/r3-code-mirror.js index 462d359..b544e20 100644 --- a/src/r3/r3-runtime/r3-code-mirror.js +++ b/src/r3/r3-runtime/r3-code-mirror.js @@ -148,7 +148,7 @@ class CodeMirror extends Coder { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-coder.js b/src/r3/r3-runtime/r3-coder.js index 96b923a..c7089d4 100644 --- a/src/r3/r3-runtime/r3-coder.js +++ b/src/r3/r3-runtime/r3-coder.js @@ -130,7 +130,7 @@ class Coder extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-control-kit.js b/src/r3/r3-runtime/r3-control-kit.js index 3baf25d..6011953 100644 --- a/src/r3/r3-runtime/r3-control-kit.js +++ b/src/r3/r3-runtime/r3-control-kit.js @@ -148,7 +148,7 @@ class ControlKit extends GUI { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-default.js b/src/r3/r3-runtime/r3-default.js index 2165d4a..3e03554 100644 --- a/src/r3/r3-runtime/r3-default.js +++ b/src/r3/r3-runtime/r3-default.js @@ -130,7 +130,7 @@ class Default extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-g-u-i.js b/src/r3/r3-runtime/r3-g-u-i.js index ae77807..167fdaa 100644 --- a/src/r3/r3-runtime/r3-g-u-i.js +++ b/src/r3/r3-runtime/r3-g-u-i.js @@ -130,7 +130,7 @@ class GUI extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-graphics.js b/src/r3/r3-runtime/r3-graphics.js index 87c292b..3c15b43 100644 --- a/src/r3/r3-runtime/r3-graphics.js +++ b/src/r3/r3-runtime/r3-graphics.js @@ -130,7 +130,7 @@ class Graphics extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-physics.js b/src/r3/r3-runtime/r3-physics.js index 42d4fba..46251ee 100644 --- a/src/r3/r3-runtime/r3-physics.js +++ b/src/r3/r3-runtime/r3-physics.js @@ -130,7 +130,7 @@ class Physics extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index cc255c9..7641627 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -111,7 +111,7 @@ class Runtime extends Event { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-socket.js b/src/r3/r3-runtime/r3-socket.js index 9b00270..711482b 100644 --- a/src/r3/r3-runtime/r3-socket.js +++ b/src/r3/r3-runtime/r3-socket.js @@ -130,7 +130,7 @@ class Socket extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-statistics.js b/src/r3/r3-runtime/r3-statistics.js index c290bfa..cd5117b 100644 --- a/src/r3/r3-runtime/r3-statistics.js +++ b/src/r3/r3-runtime/r3-statistics.js @@ -130,7 +130,7 @@ class Statistics extends Runtime { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-stats.js b/src/r3/r3-runtime/r3-stats.js index 5e11681..16068cd 100644 --- a/src/r3/r3-runtime/r3-stats.js +++ b/src/r3/r3-runtime/r3-stats.js @@ -148,7 +148,7 @@ class Stats extends Statistics { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-runtime/r3-three.js b/src/r3/r3-runtime/r3-three.js index 9b8b033..2ed1f99 100644 --- a/src/r3/r3-runtime/r3-three.js +++ b/src/r3/r3-runtime/r3-three.js @@ -148,7 +148,7 @@ class Three extends Graphics { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-system/r3-system-input.js b/src/r3/r3-system/r3-system-input.js index 4f37bfa..7e09531 100644 --- a/src/r3/r3-system/r3-system-input.js +++ b/src/r3/r3-system/r3-system-input.js @@ -118,7 +118,7 @@ class SystemInput extends System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -322,10 +322,10 @@ class SystemInput extends System { /** * OnTouchStart() * - Listens to events of type Event.TOUCH_START and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchStart(data) { + static OnTouchStart(object) { //GENERATED_STATIC_ON_TOUCH_START_METHOD_START //GENERATED_STATIC_ON_TOUCH_START_METHOD_END @@ -338,10 +338,10 @@ class SystemInput extends System { /** * OnTouchEnd() * - Listens to events of type Event.TOUCH_END and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchEnd(data) { + static OnTouchEnd(object) { //GENERATED_STATIC_ON_TOUCH_END_METHOD_START //GENERATED_STATIC_ON_TOUCH_END_METHOD_END @@ -354,10 +354,10 @@ class SystemInput extends System { /** * OnTouchMove() * - Listens to events of type Event.TOUCH_MOVE and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchMove(data) { + static OnTouchMove(object) { //GENERATED_STATIC_ON_TOUCH_MOVE_METHOD_START //GENERATED_STATIC_ON_TOUCH_MOVE_METHOD_END @@ -370,10 +370,10 @@ class SystemInput extends System { /** * OnTouchCancel() * - Listens to events of type Event.TOUCH_CANCEL and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnTouchCancel(data) { + static OnTouchCancel(object) { //GENERATED_STATIC_ON_TOUCH_CANCEL_METHOD_START //GENERATED_STATIC_ON_TOUCH_CANCEL_METHOD_END @@ -386,10 +386,10 @@ class SystemInput extends System { /** * OnKeyboardDown() * - Listens to events of type Event.KEYBOARD_DOWN and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnKeyboardDown(data) { + static OnKeyboardDown(object) { //GENERATED_STATIC_ON_KEYBOARD_DOWN_METHOD_START //GENERATED_STATIC_ON_KEYBOARD_DOWN_METHOD_END @@ -402,10 +402,10 @@ class SystemInput extends System { /** * OnKeyboardUp() * - Listens to events of type Event.KEYBOARD_UP and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnKeyboardUp(data) { + static OnKeyboardUp(object) { //GENERATED_STATIC_ON_KEYBOARD_UP_METHOD_START //GENERATED_STATIC_ON_KEYBOARD_UP_METHOD_END @@ -418,10 +418,10 @@ class SystemInput extends System { /** * OnMouseDown() * - Listens to events of type Event.MOUSE_DOWN and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseDown(data) { + static OnMouseDown(object) { //GENERATED_STATIC_ON_MOUSE_DOWN_METHOD_START //GENERATED_STATIC_ON_MOUSE_DOWN_METHOD_END @@ -434,10 +434,10 @@ class SystemInput extends System { /** * OnMouseUp() * - Listens to events of type Event.MOUSE_UP and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseUp(data) { + static OnMouseUp(object) { //GENERATED_STATIC_ON_MOUSE_UP_METHOD_START //GENERATED_STATIC_ON_MOUSE_UP_METHOD_END @@ -450,10 +450,10 @@ class SystemInput extends System { /** * OnMouseMove() * - Listens to events of type Event.MOUSE_MOVE and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseMove(data) { + static OnMouseMove(object) { //GENERATED_STATIC_ON_MOUSE_MOVE_METHOD_START //GENERATED_STATIC_ON_MOUSE_MOVE_METHOD_END @@ -466,10 +466,10 @@ class SystemInput extends System { /** * OnMouseWheel() * - Listens to events of type Event.MOUSE_WHEEL and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnMouseWheel(data) { + static OnMouseWheel(object) { //GENERATED_STATIC_ON_MOUSE_WHEEL_METHOD_START //GENERATED_STATIC_ON_MOUSE_WHEEL_METHOD_END diff --git a/src/r3/r3-system/r3-system-linking.js b/src/r3/r3-system/r3-system-linking.js index f5d5b06..cb6ceaf 100644 --- a/src/r3/r3-system/r3-system-linking.js +++ b/src/r3/r3-system/r3-system-linking.js @@ -66,6 +66,7 @@ const System = require('./r3-system.js'); CUSTOM_STATIC_EVENT_LISTENERS_START Event.OBJECT_CREATED + Event.OBJECT_INITIALIZED Event.INSTANCE_CREATED CUSTOM_STATIC_EVENT_LISTENERS_END @@ -110,7 +111,7 @@ class SystemLinking extends System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; @@ -191,6 +192,11 @@ class SystemLinking extends System { SystemLinking.OnObjectCreated ); + SystemLinking.Subscriptions['OBJECT_INITIALIZED'] = Event.Subscribe( + Event.OBJECT_INITIALIZED, + SystemLinking.OnObjectInitialized + ); + SystemLinking.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( Event.INSTANCE_CREATED, SystemLinking.OnInstanceCreated @@ -225,6 +231,9 @@ class SystemLinking extends System { 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']; @@ -253,26 +262,44 @@ class SystemLinking extends System { /** * OnObjectCreated() * - Listens to events of type Event.OBJECT_CREATED and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnObjectCreated(data) { + static OnObjectCreated(object) { //GENERATED_STATIC_ON_OBJECT_CREATED_METHOD_START //GENERATED_STATIC_ON_OBJECT_CREATED_METHOD_END //CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_START + console.log('Object Created : ' + object.name); //CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_END } + /** + * 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) { + + //GENERATED_STATIC_ON_OBJECT_INITIALIZED_METHOD_START + //GENERATED_STATIC_ON_OBJECT_INITIALIZED_METHOD_END + + //CUSTOM_STATIC_ON_OBJECT_INITIALIZED_METHOD_START + console.log('Object Initialized : ' + object.constructor.name); + //CUSTOM_STATIC_ON_OBJECT_INITIALIZED_METHOD_END + + } + /** * OnInstanceCreated() * - Listens to events of type Event.INSTANCE_CREATED and executes this function. - * @param data (The event data passed as argument - typically an R3Object) + * @param object (The event data passed as argument - typically an R3Object) * @return null */ - static OnInstanceCreated(data) { + static OnInstanceCreated(object) { //GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD_START //GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD_END diff --git a/src/r3/r3-system/r3-system-socket.js b/src/r3/r3-system/r3-system-socket.js index 483ee34..558dd77 100644 --- a/src/r3/r3-system/r3-system-socket.js +++ b/src/r3/r3-system/r3-system-socket.js @@ -108,7 +108,7 @@ class SystemSocket extends System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index df4063f..a9c2a0a 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -64,7 +64,7 @@ class System { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/r3/r3-utils.js b/src/r3/r3-utils.js index 92d817a..b561d7a 100644 --- a/src/r3/r3-utils.js +++ b/src/r3/r3-utils.js @@ -46,7 +46,7 @@ class Utils { //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/templates/constructor.template b/src/templates/constructor.template index c6c699b..59880cc 100644 --- a/src/templates/constructor.template +++ b/src/templates/constructor.template @@ -24,7 +24,7 @@ //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/templates/constructor_extends.template b/src/templates/constructor_extends.template index f6720fb..1c8c21b 100644 --- a/src/templates/constructor_extends.template +++ b/src/templates/constructor_extends.template @@ -24,7 +24,7 @@ //CUSTOM_BEFORE_INIT_END if (options.callDepth === 0) { - Event.Emit(Event.OBJECT_INITIALIZED); + Event.Emit(Event.OBJECT_INITIALIZED, this); delete this.callDepth; } else { options.callDepth--; diff --git a/src/templates/token.db b/src/templates/token.db index 78097f5..f67dcbe 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -36,6 +36,7 @@ GENERATED_STATIC_ON_MOUSE_MOVE_METHOD GENERATED_STATIC_ON_MOUSE_UP_METHOD GENERATED_STATIC_ON_MOUSE_WHEEL_METHOD GENERATED_STATIC_ON_OBJECT_CREATED_METHOD +GENERATED_STATIC_ON_OBJECT_INITIALIZED_METHOD GENERATED_STATIC_ON_TOUCH_CANCEL_METHOD GENERATED_STATIC_ON_TOUCH_END_METHOD GENERATED_STATIC_ON_TOUCH_MOVE_METHOD @@ -86,6 +87,7 @@ CUSTOM_STATIC_ON_MOUSE_MOVE_METHOD CUSTOM_STATIC_ON_MOUSE_UP_METHOD CUSTOM_STATIC_ON_MOUSE_WHEEL_METHOD CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD +CUSTOM_STATIC_ON_OBJECT_INITIALIZED_METHOD CUSTOM_STATIC_ON_TOUCH_CANCEL_METHOD CUSTOM_STATIC_ON_TOUCH_END_METHOD CUSTOM_STATIC_ON_TOUCH_MOVE_METHOD diff --git a/version b/version index ab9e439..74f7910 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.206 \ No newline at end of file +2.0.212 \ No newline at end of file