fixed system runtime

master
Theunis J. Botha 2021-09-09 18:09:09 +02:00
parent 6b77cc3067
commit ec68e2631d
11 changed files with 239 additions and 129 deletions

View File

@ -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

225
dist/r3.js vendored
View File

@ -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:
<no inherited properties>
Inherited Static Properties:
<no inherited static properties>
Inherited Methods:
<no inherited methods>
Inherited Static Methods:
<no inherited static methods>
[Belonging to SystemRuntime]
Properties:
<no properties>
Static Properties:
- Started (Default value false)
- Subscriptions (Default value {})
Methods:
<no 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();

View File

@ -1,6 +1,6 @@
{
"name": "r3",
"version" : "2.0.448",
"version" : "2.0.454",
"description": "",
"private": true,
"dependencies": {

5
r3.php
View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1 +1 @@
2.0.448
2.0.454