diff --git a/.r3_history b/.r3_history index 0d1b318..ce8e038 100644 --- a/.r3_history +++ b/.r3_history @@ -27,3 +27,4 @@ r3 create DOM extends Component ./r3-component/ r3 create Canvas extends DOM ./r3-component/ r3 create SystemDOM system r3 create Document extends Default ./r3-runtime/ +r3 create SystemRuntime system diff --git a/dist/r3.js b/dist/r3.js index 3e37ca5..6272c14 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.448'; - static compileDate = '2021 Sep 09 - 17:56:56 pm'; + static version = '2.0.454'; + static compileDate = '2021 Sep 09 - 18:08:03 pm'; } class System { @@ -20,8 +20,9 @@ class System { System.SYSTEM_DOM = 0x0; System.SYSTEM_INPUT = 0x1; System.SYSTEM_LINKING = 0x2; -System.SYSTEM_SOCKET = 0x3; -System.MAX_SYSTEMS = 0x4; +System.SYSTEM_RUNTIME = 0x3; +System.SYSTEM_SOCKET = 0x4; +System.MAX_SYSTEMS = 0x5; class Event { @@ -277,69 +278,71 @@ class Event { } -Event.COMPONENT_CREATED = 0x1; -Event.COMPONENT_INITIALIZED = 0x2; -Event.CREATE_INSTANCE_BEFORE = 0x3; -Event.DISPOSE_INSTANCE = 0x4; -Event.DISPOSE_OBJECT = 0x5; -Event.DOM_COMPONENT_INITIALIZED = 0x6; -Event.GET_RUNTIME = 0x7; -Event.GET_WINDOW_SIZE = 0x8; -Event.INPUT_COMPONENT_INITIALIZED = 0x9; -Event.INSTANCE_CREATED = 0xa; -Event.INSTANCE_DISPOSED = 0xb; -Event.KEYBOARD_DOWN = 0xc; -Event.KEYBOARD_UP = 0xd; -Event.MOUSE_DOWN = 0xe; -Event.MOUSE_MOVE = 0xf; -Event.MOUSE_UP = 0x10; -Event.MOUSE_WHEEL = 0x11; -Event.OBJECT_CREATED = 0x12; -Event.OBJECT_INITIALIZED = 0x13; -Event.PAUSE = 0x14; -Event.PROJECT_INITIALIZED = 0x15; -Event.RESTART = 0x16; -Event.START = 0x17; -Event.TOUCH_CANCEL = 0x18; -Event.TOUCH_END = 0x19; -Event.TOUCH_MOVE = 0x1a; -Event.TOUCH_START = 0x1b; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x1c; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1d; -Event.MAX_EVENTS = 0x1e; +Event.BEFORE_RENDER = 0x1; +Event.COMPONENT_CREATED = 0x2; +Event.COMPONENT_INITIALIZED = 0x3; +Event.CREATE_INSTANCE_BEFORE = 0x4; +Event.DISPOSE_INSTANCE = 0x5; +Event.DISPOSE_OBJECT = 0x6; +Event.DOM_COMPONENT_INITIALIZED = 0x7; +Event.GET_RUNTIME = 0x8; +Event.GET_WINDOW_SIZE = 0x9; +Event.INPUT_COMPONENT_INITIALIZED = 0xa; +Event.INSTANCE_CREATED = 0xb; +Event.INSTANCE_DISPOSED = 0xc; +Event.KEYBOARD_DOWN = 0xd; +Event.KEYBOARD_UP = 0xe; +Event.MOUSE_DOWN = 0xf; +Event.MOUSE_MOVE = 0x10; +Event.MOUSE_UP = 0x11; +Event.MOUSE_WHEEL = 0x12; +Event.OBJECT_CREATED = 0x13; +Event.OBJECT_INITIALIZED = 0x14; +Event.PAUSE = 0x15; +Event.PROJECT_INITIALIZED = 0x16; +Event.RESTART = 0x17; +Event.START = 0x18; +Event.TOUCH_CANCEL = 0x19; +Event.TOUCH_END = 0x1a; +Event.TOUCH_MOVE = 0x1b; +Event.TOUCH_START = 0x1c; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x1d; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1e; +Event.MAX_EVENTS = 0x1f; Event.GetEventName = function(eventId) { switch(eventId) { - case 0x1 : return 'component_created'; - case 0x2 : return 'component_initialized'; - case 0x3 : return 'create_instance_before'; - case 0x4 : return 'dispose_instance'; - case 0x5 : return 'dispose_object'; - case 0x6 : return 'dom_component_initialized'; - case 0x7 : return 'get_runtime'; - case 0x8 : return 'get_window_size'; - case 0x9 : return 'input_component_initialized'; - case 0xa : return 'instance_created'; - case 0xb : return 'instance_disposed'; - case 0xc : return 'keyboard_down'; - case 0xd : return 'keyboard_up'; - case 0xe : return 'mouse_down'; - case 0xf : return 'mouse_move'; - case 0x10 : return 'mouse_up'; - case 0x11 : return 'mouse_wheel'; - case 0x12 : return 'object_created'; - case 0x13 : return 'object_initialized'; - case 0x14 : return 'pause'; - case 0x15 : return 'project_initialized'; - case 0x16 : return 'restart'; - case 0x17 : return 'start'; - case 0x18 : return 'touch_cancel'; - case 0x19 : return 'touch_end'; - case 0x1a : return 'touch_move'; - case 0x1b : return 'touch_start'; - case 0x1c : return 'update_from_instance_after'; - case 0x1d : return 'update_from_instance_before'; + case 0x1 : return 'before_render'; + case 0x2 : return 'component_created'; + case 0x3 : return 'component_initialized'; + case 0x4 : return 'create_instance_before'; + case 0x5 : return 'dispose_instance'; + case 0x6 : return 'dispose_object'; + case 0x7 : return 'dom_component_initialized'; + case 0x8 : return 'get_runtime'; + case 0x9 : return 'get_window_size'; + case 0xa : return 'input_component_initialized'; + case 0xb : return 'instance_created'; + case 0xc : return 'instance_disposed'; + case 0xd : return 'keyboard_down'; + case 0xe : return 'keyboard_up'; + case 0xf : return 'mouse_down'; + case 0x10 : return 'mouse_move'; + case 0x11 : return 'mouse_up'; + case 0x12 : return 'mouse_wheel'; + case 0x13 : return 'object_created'; + case 0x14 : return 'object_initialized'; + case 0x15 : return 'pause'; + case 0x16 : return 'project_initialized'; + case 0x17 : return 'restart'; + case 0x18 : return 'start'; + case 0x19 : return 'touch_cancel'; + case 0x1a : return 'touch_end'; + case 0x1b : return 'touch_move'; + case 0x1c : return 'touch_start'; + case 0x1d : return 'update_from_instance_after'; + case 0x1e : return 'update_from_instance_before'; default : throw new Error('Event type not defined : ' + eventId); } @@ -2156,6 +2159,100 @@ class SystemLinking extends System { SystemLinking.Started = false; SystemLinking.Subscriptions = {}; +/** + + Class R3.System.Runtime + [Inherited from System] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemRuntime] + + Properties: + + + + Static Properties: + + - Started (Default value false) + - Subscriptions (Default value {}) + + Methods: + + + + Static Methods: + + - Start(options) + Starts the system by registering subscriptions to events + + - Stop(options) + Stops the system by removing these subscriptions to events + + Started=false + Subscriptions={} + + **/ + +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.Started = true; + + console.log('Started system: SystemRuntime'); + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + SystemRuntime.Started = false; + + console.log('Stopped system: SystemRuntime'); + + } + +} + +SystemRuntime.Started = false; +SystemRuntime.Subscriptions = {}; + /** Class R3.System.Socket @@ -5018,6 +5115,7 @@ R3.Touch = Touch; System.DOM = SystemDOM; System.Input = SystemInput; System.Linking = SystemLinking; +System.Runtime = SystemRuntime; System.Socket = SystemSocket; Component.DOM = DOM; Component.DOM.Canvas = Canvas; @@ -5040,4 +5138,5 @@ console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); R3.System.DOM.Start(); R3.System.Input.Start(); R3.System.Linking.Start(); +R3.System.Runtime.Start(); R3.System.Socket.Start(); diff --git a/package.json b/package.json index 4e2b68e..fa15a51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.448", + "version" : "2.0.454", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index 3f63368..91317fb 100755 --- a/r3.php +++ b/r3.php @@ -432,6 +432,7 @@ function generateConstructors($file, $command) { echo $file; + $constructor = null; $token = 'GENERATED_CONSTRUCTOR'; if (preg_match('/system_base/', $command)) { @@ -452,6 +453,10 @@ function generateConstructors($file, $command) $token = 'GENERATED_CONSTRUCTOR_EXTENDS'; } + if (!$constructor) { + throw new Exception('Constructor not found for file : ' . $file); + } + updateSection($file, $token , $constructor); } diff --git a/src/r3/index.js b/src/r3/index.js index 4f63b30..7a9c5b6 100644 --- a/src/r3/index.js +++ b/src/r3/index.js @@ -7,6 +7,7 @@ console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate); R3.System.DOM.Start(); R3.System.Input.Start(); R3.System.Linking.Start(); +R3.System.Runtime.Start(); R3.System.Socket.Start(); //GENERATED_INDEX_BODY_END diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 2a855b4..5b56873 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -341,69 +341,71 @@ class Event { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //GENERATED_EVENTS_START -Event.COMPONENT_CREATED = 0x1; -Event.COMPONENT_INITIALIZED = 0x2; -Event.CREATE_INSTANCE_BEFORE = 0x3; -Event.DISPOSE_INSTANCE = 0x4; -Event.DISPOSE_OBJECT = 0x5; -Event.DOM_COMPONENT_INITIALIZED = 0x6; -Event.GET_RUNTIME = 0x7; -Event.GET_WINDOW_SIZE = 0x8; -Event.INPUT_COMPONENT_INITIALIZED = 0x9; -Event.INSTANCE_CREATED = 0xa; -Event.INSTANCE_DISPOSED = 0xb; -Event.KEYBOARD_DOWN = 0xc; -Event.KEYBOARD_UP = 0xd; -Event.MOUSE_DOWN = 0xe; -Event.MOUSE_MOVE = 0xf; -Event.MOUSE_UP = 0x10; -Event.MOUSE_WHEEL = 0x11; -Event.OBJECT_CREATED = 0x12; -Event.OBJECT_INITIALIZED = 0x13; -Event.PAUSE = 0x14; -Event.PROJECT_INITIALIZED = 0x15; -Event.RESTART = 0x16; -Event.START = 0x17; -Event.TOUCH_CANCEL = 0x18; -Event.TOUCH_END = 0x19; -Event.TOUCH_MOVE = 0x1a; -Event.TOUCH_START = 0x1b; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x1c; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1d; -Event.MAX_EVENTS = 0x1e; +Event.BEFORE_RENDER = 0x1; +Event.COMPONENT_CREATED = 0x2; +Event.COMPONENT_INITIALIZED = 0x3; +Event.CREATE_INSTANCE_BEFORE = 0x4; +Event.DISPOSE_INSTANCE = 0x5; +Event.DISPOSE_OBJECT = 0x6; +Event.DOM_COMPONENT_INITIALIZED = 0x7; +Event.GET_RUNTIME = 0x8; +Event.GET_WINDOW_SIZE = 0x9; +Event.INPUT_COMPONENT_INITIALIZED = 0xa; +Event.INSTANCE_CREATED = 0xb; +Event.INSTANCE_DISPOSED = 0xc; +Event.KEYBOARD_DOWN = 0xd; +Event.KEYBOARD_UP = 0xe; +Event.MOUSE_DOWN = 0xf; +Event.MOUSE_MOVE = 0x10; +Event.MOUSE_UP = 0x11; +Event.MOUSE_WHEEL = 0x12; +Event.OBJECT_CREATED = 0x13; +Event.OBJECT_INITIALIZED = 0x14; +Event.PAUSE = 0x15; +Event.PROJECT_INITIALIZED = 0x16; +Event.RESTART = 0x17; +Event.START = 0x18; +Event.TOUCH_CANCEL = 0x19; +Event.TOUCH_END = 0x1a; +Event.TOUCH_MOVE = 0x1b; +Event.TOUCH_START = 0x1c; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x1d; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x1e; +Event.MAX_EVENTS = 0x1f; Event.GetEventName = function(eventId) { switch(eventId) { - case 0x1 : return 'component_created'; - case 0x2 : return 'component_initialized'; - case 0x3 : return 'create_instance_before'; - case 0x4 : return 'dispose_instance'; - case 0x5 : return 'dispose_object'; - case 0x6 : return 'dom_component_initialized'; - case 0x7 : return 'get_runtime'; - case 0x8 : return 'get_window_size'; - case 0x9 : return 'input_component_initialized'; - case 0xa : return 'instance_created'; - case 0xb : return 'instance_disposed'; - case 0xc : return 'keyboard_down'; - case 0xd : return 'keyboard_up'; - case 0xe : return 'mouse_down'; - case 0xf : return 'mouse_move'; - case 0x10 : return 'mouse_up'; - case 0x11 : return 'mouse_wheel'; - case 0x12 : return 'object_created'; - case 0x13 : return 'object_initialized'; - case 0x14 : return 'pause'; - case 0x15 : return 'project_initialized'; - case 0x16 : return 'restart'; - case 0x17 : return 'start'; - case 0x18 : return 'touch_cancel'; - case 0x19 : return 'touch_end'; - case 0x1a : return 'touch_move'; - case 0x1b : return 'touch_start'; - case 0x1c : return 'update_from_instance_after'; - case 0x1d : return 'update_from_instance_before'; + case 0x1 : return 'before_render'; + case 0x2 : return 'component_created'; + case 0x3 : return 'component_initialized'; + case 0x4 : return 'create_instance_before'; + case 0x5 : return 'dispose_instance'; + case 0x6 : return 'dispose_object'; + case 0x7 : return 'dom_component_initialized'; + case 0x8 : return 'get_runtime'; + case 0x9 : return 'get_window_size'; + case 0xa : return 'input_component_initialized'; + case 0xb : return 'instance_created'; + case 0xc : return 'instance_disposed'; + case 0xd : return 'keyboard_down'; + case 0xe : return 'keyboard_up'; + case 0xf : return 'mouse_down'; + case 0x10 : return 'mouse_move'; + case 0x11 : return 'mouse_up'; + case 0x12 : return 'mouse_wheel'; + case 0x13 : return 'object_created'; + case 0x14 : return 'object_initialized'; + case 0x15 : return 'pause'; + case 0x16 : return 'project_initialized'; + case 0x17 : return 'restart'; + case 0x18 : return 'start'; + case 0x19 : return 'touch_cancel'; + case 0x1a : return 'touch_end'; + case 0x1b : return 'touch_move'; + case 0x1c : return 'touch_start'; + case 0x1d : return 'update_from_instance_after'; + case 0x1e : return 'update_from_instance_before'; default : throw new Error('Event type not defined : ' + eventId); } diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 8981da2..4b03652 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.448'; - static compileDate = '2021 Sep 09 - 17:56:56 pm'; + static version = '2.0.454'; + static compileDate = '2021 Sep 09 - 18:08:03 pm'; } //GENERATED_IMPORTS_START diff --git a/src/r3/r3-system/index.js b/src/r3/r3-system/index.js index ba58a1b..b827462 100644 --- a/src/r3/r3-system/index.js +++ b/src/r3/r3-system/index.js @@ -3,6 +3,7 @@ const System = require('./r3-system.js'); const SystemDOM = require('./r3-system-d-o-m.js'); const SystemInput = require('./r3-system-input.js'); const SystemLinking = require('./r3-system-linking.js'); +const SystemRuntime = require('./r3-system-runtime.js'); const SystemSocket = require('./r3-system-socket.js'); //GENERATED_IMPORTS_END @@ -10,6 +11,7 @@ const SystemSocket = require('./r3-system-socket.js'); System.DOM = SystemDOM; System.Input = SystemInput; System.Linking = SystemLinking; +System.Runtime = SystemRuntime; System.Socket = SystemSocket; //GENERATED_INDEX_BODY_END diff --git a/src/r3/r3-system/r3-system.js b/src/r3/r3-system/r3-system.js index 263adc2..6d9c3a9 100644 --- a/src/r3/r3-system/r3-system.js +++ b/src/r3/r3-system/r3-system.js @@ -72,8 +72,9 @@ class System { System.SYSTEM_DOM = 0x0; System.SYSTEM_INPUT = 0x1; System.SYSTEM_LINKING = 0x2; -System.SYSTEM_SOCKET = 0x3; -System.MAX_SYSTEMS = 0x4; +System.SYSTEM_RUNTIME = 0x3; +System.SYSTEM_SOCKET = 0x4; +System.MAX_SYSTEMS = 0x5; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/templates/token.db b/src/templates/token.db index ef8576f..ac04c8f 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -55,7 +55,6 @@ CUSTOM_ASYNC_METHOD CUSTOM_BEFORE_INIT CUSTOM_BEFORE_STATIC_SYSTEM_START CUSTOM_BEFORE_STATIC_SYSTEM_STOP -CUSTOM_BEFORE_SYSTEM CUSTOM_BEFORE_SYSTEM_START CUSTOM_BEFORE_SYSTEM_STOP CUSTOM_CONVENIENT_DEFINES diff --git a/version b/version index 9b67bea..4e6e09e 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.448 \ No newline at end of file +2.0.454 \ No newline at end of file