runtime templates part 2

master
Theunis J. Botha 2021-10-11 07:12:55 +02:00
parent c981904d8c
commit 9b9691a248
19 changed files with 470 additions and 358 deletions

View File

@ -34,7 +34,6 @@ r3 create SystemSocket system_extends System ./r3-system/
r3 create Utils base ./
r3 create SystemRender system_extends System ./r3-system/
r3 create SystemStorage system_extends System ./r3-system/
r3 create RuntimeImage runtime_base ./r3-runtime/
r3 create Runtime base ./r3-runtime/
r3 create ComponentCode component_extends Component ./r3-component/
r3 create R3Object object_base ./r3-object/
@ -48,3 +47,4 @@ r3 create Graph base ./
r3 create Node base ./
r3 create RuntimeJSDOM runtime_extends RuntimeDOM ./r3-runtime/
r3 create RuntimeWebDOM runtime_extends RuntimeDOM ./r3-runtime/
r3 create ComponentTest component_extends ComponentDOM ./r3-component/ RuntimeDOM

445
dist/r3.js vendored
View File

@ -1382,12 +1382,6 @@ SystemRender.Subscriptions = {};
- Projects (Default value [])
- CurrentProject (Default value null)
- ServerSide (Default value (typeof process !)
- RuntimeCoder (Default value {})
- RuntimeDOM (Default value {})
- RuntimeGUI (Default value {})
- RuntimeGraphics (Default value {})
- RuntimePhysics (Default value {})
- RuntimeStatistics (Default value {})
Methods:
@ -1496,9 +1490,7 @@ class SystemRuntime extends System {
* the DOM.
*/
if (
object instanceof ComponentDOM ||
object instanceof ComponentImage ||
object instanceof ComponentInput
object.runtimeClass === RuntimeDOM
) {
if (SystemRuntime.CurrentProject === null) {
@ -1598,34 +1590,12 @@ SystemRuntime.CurrentProject = null;
*/
SystemRuntime.ServerSide = (typeof process !== 'undefined');
/**
* 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.RuntimeSocket = {};
SystemRuntime.RuntimeStatistics = {};
/**
@ -1860,17 +1830,16 @@ Runtime.BASE_CODER = 0x0;
Runtime.BASE_DOM = 0x1;
Runtime.BASE_GUI = 0x2;
Runtime.BASE_GRAPHICS = 0x3;
Runtime.BASE_IMAGE = 0x4;
Runtime.BASE_PHYSICS = 0x5;
Runtime.BASE_SOCKET = 0x6;
Runtime.BASE_STATISTICS = 0x7;
Runtime.CODE_MIRROR = 0x8;
Runtime.JSDOM = 0x9;
Runtime.WEB_DOM = 0xa;
Runtime.CONTROL_KIT = 0xb;
Runtime.THREE = 0xc;
Runtime.BULLET = 0xd;
Runtime.STATS = 0xe;
Runtime.BASE_PHYSICS = 0x4;
Runtime.BASE_SOCKET = 0x5;
Runtime.BASE_STATISTICS = 0x6;
Runtime.CODE_MIRROR = 0x7;
Runtime.JSDOM = 0x8;
Runtime.WEB_DOM = 0x9;
Runtime.CONTROL_KIT = 0xa;
Runtime.THREE = 0xb;
Runtime.BULLET = 0xc;
Runtime.STATS = 0xd;
/**
@ -2582,71 +2551,6 @@ class RuntimeThree extends RuntimeGraphics {
}
/**
Class R3.Runtime.Image
[Inherited from Runtime]
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 RuntimeImage]
Properties:
<no properties>
Static Properties:
<no static properties>
Methods:
<no methods>
Static Methods:
<no static methods>
**/
class RuntimeImage extends Runtime {
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
super(options);
/**
* name - Name of the runtime
*/
if (typeof options.name === 'undefined') {
options.name = this.constructor.name;
}
Object.assign(this, options);
Event.Emit(Event.RUNTIME_CREATED, this);
}
}
/**
Class R3.Runtime.Physics
@ -3657,17 +3561,18 @@ R3Object.COMPONENT = 0x3;
R3Object.COMPONENT_CODE = 0x4;
R3Object.COMPONENT_DOM = 0x5;
R3Object.COMPONENT_CANVAS = 0x6;
R3Object.COMPONENT_GEOMETRY = 0x7;
R3Object.COMPONENT_BUFFER_GEOMETRY = 0x8;
R3Object.COMPONENT_PLANE_GEOMETRY = 0x9;
R3Object.COMPONENT_GRAPHICS = 0xa;
R3Object.COMPONENT_IMAGE = 0xb;
R3Object.COMPONENT_INPUT = 0xc;
R3Object.COMPONENT_TOUCH = 0xd;
R3Object.COMPONENT_MATERIAL = 0xe;
R3Object.COMPONENT_MESH = 0xf;
R3Object.COMPONENT_TEXTURE = 0x10;
R3Object.MAX_R3OBJECT = 0x11;
R3Object.COMPONENT_TEST = 0x7;
R3Object.COMPONENT_GEOMETRY = 0x8;
R3Object.COMPONENT_BUFFER_GEOMETRY = 0x9;
R3Object.COMPONENT_PLANE_GEOMETRY = 0xa;
R3Object.COMPONENT_GRAPHICS = 0xb;
R3Object.COMPONENT_IMAGE = 0xc;
R3Object.COMPONENT_INPUT = 0xd;
R3Object.COMPONENT_TOUCH = 0xe;
R3Object.COMPONENT_MATERIAL = 0xf;
R3Object.COMPONENT_MESH = 0x10;
R3Object.COMPONENT_TEXTURE = 0x11;
R3Object.MAX_R3OBJECT = 0x12;
R3Object.READY_STATE_FALSE = 0x1;
R3Object.READY_STATE_PENDING_FALSE = 0x2;
@ -4603,17 +4508,18 @@ class Component extends R3Object {
Component.CODE = 0x0;
Component.DOM = 0x1;
Component.CANVAS = 0x2;
Component.GEOMETRY = 0x3;
Component.BUFFER_GEOMETRY = 0x4;
Component.PLANE_GEOMETRY = 0x5;
Component.GRAPHICS = 0x6;
Component.IMAGE = 0x7;
Component.INPUT = 0x8;
Component.TOUCH = 0x9;
Component.MATERIAL = 0xa;
Component.MESH = 0xb;
Component.TEXTURE = 0xc;
Component.MAX_COMPONENT = 0xd;
Component.TEST = 0x3;
Component.GEOMETRY = 0x4;
Component.BUFFER_GEOMETRY = 0x5;
Component.PLANE_GEOMETRY = 0x6;
Component.GRAPHICS = 0x7;
Component.IMAGE = 0x8;
Component.INPUT = 0x9;
Component.TOUCH = 0xa;
Component.MATERIAL = 0xb;
Component.MESH = 0xc;
Component.TEXTURE = 0xd;
Component.MAX_COMPONENT = 0xe;
/**
@ -5348,6 +5254,281 @@ class ComponentCanvas extends ComponentDOM {
}
/**
Class R3.Event.Object.Component.DOM.Test
[Inherited from Event]
Inherited Properties:
<no inherited properties>
Inherited Static Properties:
<no 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:
<no inherited properties>
Inherited Static Properties:
<no inherited static properties>
Inherited Methods:
<no inherited methods>
Inherited Static Methods:
<no inherited static methods>
[Inherited from Component]
Inherited Properties:
<no inherited properties>
Inherited Static Properties:
<no inherited static properties>
Inherited Methods:
<no inherited methods>
Inherited Static Methods:
<no 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:
<no inherited static properties>
Inherited Methods:
<no inherited methods>
Inherited Static Methods:
<no inherited static methods>
[Belonging to ComponentTest]
Properties:
<no properties>
Static Properties:
<no static properties>
Methods:
<no methods>
Static Methods:
<no static methods>
**/
class ComponentTest extends ComponentDOM {
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
options.maxDepth = options.callDepth;
super(options);
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* runtime - Holds the current runtime instance of this Component based on the Runtime Class
*/
if (typeof options.runtime === 'undefined') {
options.runtime = null;
}
/**
* runtimeClass - No comment
*/
if (typeof options.runtimeClass === 'undefined') {
options.runtimeClass = RuntimeDOM;
}
for (let r = 0; r < this.required.length; r++) {
this.ready[r] = true;
}
this.underConstruction = true;
Object.assign(this, options);
this.underConstruction = false;
if (options.callDepth === 0) {
this.initialize();
} else {
options.callDepth--;
}
}
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
super.initialize();
if (this.initializeDepth === this.maxDepth) {
this.emit(Event.FINAL_INITIALIZE, this);
} else {
this.initializeDepth++;
}
}
/**
* 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 === 'runtime') {
this.instance.runtime = this.runtime;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'runtime',
instanceProperty : 'runtime'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'runtimeClass') {
this.instance.runtimeClass = this.runtimeClass;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'runtimeClass',
instanceProperty : 'runtimeClass'
}
);
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 === 'runtime' || property === 'all') {
this.runtime = this.instance.runtime;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'runtime',
instanceProperty : 'runtime'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'runtimeClass' || property === 'all') {
this.runtimeClass = this.instance.runtimeClass;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'runtimeClass',
instanceProperty : 'runtimeClass'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
}
/**
Class R3.Event.Object.Component.Geometry
@ -9500,6 +9681,7 @@ console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
Component.Code = ComponentCode;
Component.DOM = ComponentDOM;
Component.DOM.Canvas = ComponentCanvas;
Component.DOM.Test = ComponentTest;
Component.Geometry = ComponentGeometry;
Component.Geometry.BufferGeometry = ComponentBufferGeometry;
Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry;
@ -9518,6 +9700,7 @@ R3Object.Component = Component;
R3Object.Component.Code = ComponentCode;
R3Object.Component.DOM = ComponentDOM;
R3Object.Component.DOM.Canvas = ComponentCanvas;
R3Object.Component.DOM.Test = ComponentTest;
R3Object.Component.Geometry = ComponentGeometry;
R3Object.Component.Geometry.BufferGeometry = ComponentBufferGeometry;
R3Object.Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry;
@ -9537,7 +9720,6 @@ Runtime.GUI = RuntimeGUI;
Runtime.GUI.ControlKit = RuntimeControlKit;
Runtime.Graphics = RuntimeGraphics;
Runtime.Graphics.Three = RuntimeThree;
Runtime.Image = RuntimeImage;
Runtime.Physics = RuntimePhysics;
Runtime.Physics.Bullet = RuntimeBullet;
Runtime.Socket = RuntimeSocket;
@ -9562,6 +9744,7 @@ R3.Entity = Entity;
R3.Component = Component;
R3.Code = R3Object.Component.Code;
R3.Canvas = R3Object.Component.DOM.Canvas;
R3.Test = R3Object.Component.DOM.Test;
R3.PlaneGeometry = R3Object.Component.Geometry.BufferGeometry.PlaneGeometry;
R3.Image = R3Object.Component.Graphics.Image;
R3.Touch = R3Object.Component.Input.Touch;

View File

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

43
r3.php
View File

@ -2034,6 +2034,47 @@ function generateOutOfClassImplementationDefines($graph, $types)
//
//}
function buildRuntimeImports(&$imports, $node, $depth = 1)
{
foreach ($node->children as $runtimeBaseNode) {
array_push($imports, "const " . $runtimeBaseNode->name . " = require('" . str_replace('src/r3', '..', $runtimeBaseNode->file) . "');");
}
foreach ($node->children as $runtimeBaseNode) {
if ($depth === 0) {
array_push($imports, "\n// " . $runtimeBaseNode->name . ' Runtimes');
}
buildRuntimeImports($imports, $runtimeBaseNode);
}
}
function buildRuntimeOutOfClassDefines(&$outOfClassDefines, $node, $depth = 1)
{
foreach ($node->children as $runtimeBaseNode) {
array_push($outOfClassDefines, "SystemRuntime." . $runtimeBaseNode->name . " = {};");
}
}
function generateRuntimeSystem($graph)
{
echo "Updating Runtime System\n";
$node = $graph->search('name', 'Runtime');
$imports = [];
buildRuntimeImports($imports, $node, 0);
$outOfClassDefines = [];
buildRuntimeOutOfClassDefines($outOfClassDefines, $node, 0);
updateSection('./src/r3/r3-system/r3-system-runtime.js', 'GENERATED_IMPORTS', $imports, "\n");
updateSection('./src/r3/r3-system/r3-system-runtime.js', 'GENERATED_OUT_OF_CLASS_IMPLEMENTATION', $outOfClassDefines, "\n");
}
$nodeList = [];
/**
@ -2237,6 +2278,8 @@ if ($argv[2] == 'build-dist') {
echo "Building Distribution\n";
generateRuntimeSystem($graph);
generateR3($nodes, $graph);
generateR3Dist($nodes);

View File

@ -25,6 +25,7 @@ R3.Entity = Entity;
R3.Component = Component;
R3.Code = R3Object.Component.Code;
R3.Canvas = R3Object.Component.DOM.Canvas;
R3.Test = R3Object.Component.DOM.Test;
R3.PlaneGeometry = R3Object.Component.Geometry.BufferGeometry.PlaneGeometry;
R3.Image = R3Object.Component.Graphics.Image;
R3.Touch = R3Object.Component.Input.Touch;

View File

@ -3,6 +3,7 @@ const Component = require('./r3-component.js');
const ComponentCode = require('./r3-component-code.js');
const ComponentDOM = require('./r3-component-d-o-m.js');
const ComponentCanvas = require('./r3-component-canvas.js');
const ComponentTest = require('./r3-component-test.js');
const ComponentGeometry = require('./r3-component-geometry.js');
const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js');
const ComponentPlaneGeometry = require('./r3-component-plane-geometry.js');
@ -19,6 +20,7 @@ const ComponentTexture = require('./r3-component-texture.js');
Component.Code = ComponentCode;
Component.DOM = ComponentDOM;
Component.DOM.Canvas = ComponentCanvas;
Component.DOM.Test = ComponentTest;
Component.Geometry = ComponentGeometry;
Component.Geometry.BufferGeometry = ComponentBufferGeometry;
Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry;

View File

@ -331,17 +331,18 @@ class Component extends R3Object {
Component.CODE = 0x0;
Component.DOM = 0x1;
Component.CANVAS = 0x2;
Component.GEOMETRY = 0x3;
Component.BUFFER_GEOMETRY = 0x4;
Component.PLANE_GEOMETRY = 0x5;
Component.GRAPHICS = 0x6;
Component.IMAGE = 0x7;
Component.INPUT = 0x8;
Component.TOUCH = 0x9;
Component.MATERIAL = 0xa;
Component.MESH = 0xb;
Component.TEXTURE = 0xc;
Component.MAX_COMPONENT = 0xd;
Component.TEST = 0x3;
Component.GEOMETRY = 0x4;
Component.BUFFER_GEOMETRY = 0x5;
Component.PLANE_GEOMETRY = 0x6;
Component.GRAPHICS = 0x7;
Component.IMAGE = 0x8;
Component.INPUT = 0x9;
Component.TOUCH = 0xa;
Component.MATERIAL = 0xb;
Component.MESH = 0xc;
Component.TEXTURE = 0xd;
Component.MAX_COMPONENT = 0xe;
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -7,6 +7,7 @@ const Component = require('../r3-component/r3-component.js');
const ComponentCode = require('../r3-component/r3-component-code.js');
const ComponentDOM = require('../r3-component/r3-component-d-o-m.js');
const ComponentCanvas = require('../r3-component/r3-component-canvas.js');
const ComponentTest = require('../r3-component/r3-component-test.js');
const ComponentGeometry = require('../r3-component/r3-component-geometry.js');
const ComponentBufferGeometry = require('../r3-component/r3-component-buffer-geometry.js');
const ComponentPlaneGeometry = require('../r3-component/r3-component-plane-geometry.js');
@ -27,6 +28,7 @@ R3Object.Component = Component;
R3Object.Component.Code = ComponentCode;
R3Object.Component.DOM = ComponentDOM;
R3Object.Component.DOM.Canvas = ComponentCanvas;
R3Object.Component.DOM.Test = ComponentTest;
R3Object.Component.Geometry = ComponentGeometry;
R3Object.Component.Geometry.BufferGeometry = ComponentBufferGeometry;
R3Object.Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry;

View File

@ -418,17 +418,18 @@ R3Object.COMPONENT = 0x3;
R3Object.COMPONENT_CODE = 0x4;
R3Object.COMPONENT_DOM = 0x5;
R3Object.COMPONENT_CANVAS = 0x6;
R3Object.COMPONENT_GEOMETRY = 0x7;
R3Object.COMPONENT_BUFFER_GEOMETRY = 0x8;
R3Object.COMPONENT_PLANE_GEOMETRY = 0x9;
R3Object.COMPONENT_GRAPHICS = 0xa;
R3Object.COMPONENT_IMAGE = 0xb;
R3Object.COMPONENT_INPUT = 0xc;
R3Object.COMPONENT_TOUCH = 0xd;
R3Object.COMPONENT_MATERIAL = 0xe;
R3Object.COMPONENT_MESH = 0xf;
R3Object.COMPONENT_TEXTURE = 0x10;
R3Object.MAX_R3OBJECT = 0x11;
R3Object.COMPONENT_TEST = 0x7;
R3Object.COMPONENT_GEOMETRY = 0x8;
R3Object.COMPONENT_BUFFER_GEOMETRY = 0x9;
R3Object.COMPONENT_PLANE_GEOMETRY = 0xa;
R3Object.COMPONENT_GRAPHICS = 0xb;
R3Object.COMPONENT_IMAGE = 0xc;
R3Object.COMPONENT_INPUT = 0xd;
R3Object.COMPONENT_TOUCH = 0xe;
R3Object.COMPONENT_MATERIAL = 0xf;
R3Object.COMPONENT_MESH = 0x10;
R3Object.COMPONENT_TEXTURE = 0x11;
R3Object.MAX_R3OBJECT = 0x12;
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -9,7 +9,6 @@ const RuntimeGUI = require('./r3-runtime-g-u-i.js');
const RuntimeControlKit = require('./r3-runtime-control-kit.js');
const RuntimeGraphics = require('./r3-runtime-graphics.js');
const RuntimeThree = require('./r3-runtime-three.js');
const RuntimeImage = require('./r3-runtime-image.js');
const RuntimePhysics = require('./r3-runtime-physics.js');
const RuntimeBullet = require('./r3-runtime-bullet.js');
const RuntimeSocket = require('./r3-runtime-socket.js');
@ -27,7 +26,6 @@ Runtime.GUI = RuntimeGUI;
Runtime.GUI.ControlKit = RuntimeControlKit;
Runtime.Graphics = RuntimeGraphics;
Runtime.Graphics.Three = RuntimeThree;
Runtime.Image = RuntimeImage;
Runtime.Physics = RuntimePhysics;
Runtime.Physics.Bullet = RuntimeBullet;
Runtime.Socket = RuntimeSocket;

View File

@ -1,137 +0,0 @@
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('.././r3-event');
const Runtime = require('./r3-runtime.js');
/**
GENERATED_INHERITED_START
Class R3.Runtime.Image
[Inherited from Runtime]
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 RuntimeImage]
Properties:
<no properties>
Static Properties:
<no static properties>
Methods:
<no methods>
Static Methods:
<no static methods>
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
name=this.constructor.name - Name of the runtime
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END
CUSTOM_STATIC_OPTIONS_START
CUSTOM_STATIC_OPTIONS_END
TEMPLATE_METHODS_START
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
TEMPLATE_STATIC_METHODS_END
CUSTOM_STATIC_METHODS_START
CUSTOM_STATIC_METHODS_END
**/
class RuntimeImage extends Runtime {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* name - Name of the runtime
*/
if (typeof options.name === 'undefined') {
options.name = this.constructor.name;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
Object.assign(this, options);
Event.Emit(Event.RUNTIME_CREATED, this);
}
//GENERATED_CONSTRUCTOR_END
//GENERATED_TEMPLATE_METHODS_START
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START
//GENERATED_TEMPLATE_STATIC_METHODS_END
//GENERATED_STATIC_METHODS_START
//GENERATED_STATIC_METHODS_END
//CUSTOM_IMPLEMENTATION_START
//CUSTOM_IMPLEMENTATION_END
}
//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START
//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END
//GENERATED_STATIC_OPTIONS_INIT_START
//GENERATED_STATIC_OPTIONS_INIT_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 = RuntimeImage;

View File

@ -92,17 +92,16 @@ Runtime.BASE_CODER = 0x0;
Runtime.BASE_DOM = 0x1;
Runtime.BASE_GUI = 0x2;
Runtime.BASE_GRAPHICS = 0x3;
Runtime.BASE_IMAGE = 0x4;
Runtime.BASE_PHYSICS = 0x5;
Runtime.BASE_SOCKET = 0x6;
Runtime.BASE_STATISTICS = 0x7;
Runtime.CODE_MIRROR = 0x8;
Runtime.JSDOM = 0x9;
Runtime.WEB_DOM = 0xa;
Runtime.CONTROL_KIT = 0xb;
Runtime.THREE = 0xc;
Runtime.BULLET = 0xd;
Runtime.STATS = 0xe;
Runtime.BASE_PHYSICS = 0x4;
Runtime.BASE_SOCKET = 0x5;
Runtime.BASE_STATISTICS = 0x6;
Runtime.CODE_MIRROR = 0x7;
Runtime.JSDOM = 0x8;
Runtime.WEB_DOM = 0x9;
Runtime.CONTROL_KIT = 0xa;
Runtime.THREE = 0xb;
Runtime.BULLET = 0xc;
Runtime.STATS = 0xd;
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -1,13 +1,36 @@
//GENERATED_IMPORTS_START
const RuntimeCoder = require('../r3-runtime/r3-runtime-coder.js');
const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js');
const RuntimeGUI = require('../r3-runtime/r3-runtime-g-u-i.js');
const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js');
const RuntimePhysics = require('../r3-runtime/r3-runtime-physics.js');
const RuntimeSocket = require('../r3-runtime/r3-runtime-socket.js');
const RuntimeStatistics = require('../r3-runtime/r3-runtime-statistics.js');
// RuntimeCoder Runtimes
const RuntimeCodeMirror = require('../r3-runtime/r3-runtime-code-mirror.js');
// RuntimeDOM Runtimes
const RuntimeJSDOM = require('../r3-runtime/r3-runtime-j-s-d-o-m.js');
const RuntimeWebDOM = require('../r3-runtime/r3-runtime-web-d-o-m.js');
// RuntimeGUI Runtimes
const RuntimeControlKit = require('../r3-runtime/r3-runtime-control-kit.js');
// RuntimeGraphics Runtimes
const RuntimeThree = require('../r3-runtime/r3-runtime-three.js');
// RuntimePhysics Runtimes
const RuntimeBullet = require('../r3-runtime/r3-runtime-bullet.js');
// RuntimeSocket Runtimes
// RuntimeStatistics Runtimes
const RuntimeStats = require('../r3-runtime/r3-runtime-stats.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
const ComponentDOM = require('../r3-component/r3-component-d-o-m.js');
const ComponentInput = require('../r3-component/r3-component-input.js');
const ComponentImage = require('../r3-component/r3-component-image.js');
const ComponentCode = require('../r3-component/r3-component-code.js');
const RuntimeWebDOM = require('../r3-runtime/r3-runtime-web-d-o-m.js');
const RuntimeJSDOM = require('../r3-runtime/r3-runtime-j-s-d-o-m.js');
const Utils = require('.././r3-utils.js');
//CUSTOM_IMPORTS_END
@ -48,12 +71,6 @@ const System = require('./r3-system.js');
- Projects (Default value [])
- CurrentProject (Default value null)
- ServerSide (Default value (typeof process !)
- RuntimeCoder (Default value {})
- RuntimeDOM (Default value {})
- RuntimeGUI (Default value {})
- RuntimeGraphics (Default value {})
- RuntimePhysics (Default value {})
- RuntimeStatistics (Default value {})
Methods:
@ -80,12 +97,6 @@ const System = require('./r3-system.js');
Projects=[]
CurrentProject=null
ServerSide=(typeof process !== 'undefined')
RuntimeCoder={}
RuntimeDOM={}
RuntimeGUI={}
RuntimeGraphics={}
RuntimePhysics={}
RuntimeStatistics={}
CUSTOM_STATIC_OPTIONS_END
CUSTOM_EVENT_LISTENERS_START
@ -268,6 +279,8 @@ class SystemRuntime extends System {
static OnGetRuntime(object) {
//GENERATED_STATIC_ON_GET_RUNTIME_METHOD_START
//GENERATED_RUNTIME_LOCATOR_START
//GENERATED_RUNTIME_LOCATOR_END
//GENERATED_STATIC_ON_GET_RUNTIME_METHOD_END
//CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_START
@ -276,9 +289,7 @@ class SystemRuntime extends System {
* the DOM.
*/
if (
object instanceof ComponentDOM ||
object instanceof ComponentImage ||
object instanceof ComponentInput
object.runtimeClass === RuntimeDOM
) {
if (SystemRuntime.CurrentProject === null) {
@ -398,39 +409,16 @@ SystemRuntime.CurrentProject = null;
*/
SystemRuntime.ServerSide = (typeof process !== 'undefined');
/**
* 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 = {};
//GENERATED_STATIC_OPTIONS_INIT_END
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
SystemRuntime.RuntimeCoder = {};
SystemRuntime.RuntimeDOM = {};
SystemRuntime.RuntimeGUI = {};
SystemRuntime.RuntimeGraphics = {};
SystemRuntime.RuntimePhysics = {};
SystemRuntime.RuntimeSocket = {};
SystemRuntime.RuntimeStatistics = {};
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -7,6 +7,7 @@
const Component = require('../r3-component/r3-component.js');
const Event = require('../r3-event.js');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
const RUNTIME_CLASS = require('../r3-runtime/RUNTIME_CLASS_FILE_NAME');
/**
@ -16,6 +17,8 @@ const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
TEMPLATE_OPTIONS_START
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
runtime=null - Holds the current runtime instance of this Component based on the Runtime Class
runtimeClass=RUNTIME_CLASS
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START

View File

@ -0,0 +1,24 @@
if (
object.runtimeClass === RUNTIME_CLASS
) {
if (SystemRuntime.CurrentProject === null) {
/**
* We use the default runtime
*/
if (SystemRuntime.ServerSide) {
//GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START
throw new Error('No server side implementation for RUNTIME_CLASS');
//GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END
} else {
//GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START
throw new Error('No client side implementation for RUNTIME_CLASS');
//GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END
}
} else {
/**
* Get runtime from project
*/
console.log('todo : implement project based runtime here');
}
}

View File

@ -0,0 +1,2 @@
//GENERATED_RUNTIME_LOCATOR_START
//GENERATED_RUNTIME_LOCATOR_END

View File

@ -55,6 +55,7 @@ GENERATED_RE_ORDER_METHOD_AFTER
GENERATED_REQUIRED_COMPONENTS
GENERATED_REQUIREMENT_VALUE_CHECK_METHOD
GENERATED_REQUIREMENT_VALUE_CHECK_METHOD_AFTER
GENERATED_RUNTIME_LOCATOR
GENERATED_SET_RUNTIME_METHOD
GENERATED_SET_RUNTIME_METHOD_AFTER
GENERATED_SOURCE

View File

@ -5,6 +5,7 @@ const Event = require('../src/r3/r3-event.js');
const ComponentCode = require('../src/r3/r3-component/./r3-component-code.js');
const ComponentDOM = require('../src/r3/r3-component/./r3-component-d-o-m.js');
const ComponentCanvas = require('../src/r3/r3-component/./r3-component-canvas.js');
const ComponentTest = require('../src/r3/r3-component/./r3-component-test.js');
const ComponentGeometry = require('../src/r3/r3-component/./r3-component-geometry.js');
const ComponentBufferGeometry = require('../src/r3/r3-component/./r3-component-buffer-geometry.js');
const ComponentPlaneGeometry = require('../src/r3/r3-component/./r3-component-plane-geometry.js');
@ -31,7 +32,6 @@ const RuntimeGUI = require('../src/r3/r3-runtime/./r3-runtime-g-u-i.js');
const RuntimeControlKit = require('../src/r3/r3-runtime/./r3-runtime-control-kit.js');
const RuntimeGraphics = require('../src/r3/r3-runtime/./r3-runtime-graphics.js');
const RuntimeThree = require('../src/r3/r3-runtime/./r3-runtime-three.js');
const RuntimeImage = require('../src/r3/r3-runtime/./r3-runtime-image.js');
const RuntimePhysics = require('../src/r3/r3-runtime/./r3-runtime-physics.js');
const RuntimeBullet = require('../src/r3/r3-runtime/./r3-runtime-bullet.js');
const RuntimeSocket = require('../src/r3/r3-runtime/./r3-runtime-socket.js');
@ -71,6 +71,8 @@ describe('R3 Tests', () => {
assert.isTrue(componentDOM.initialized);
const componentCanvas = new ComponentCanvas();
assert.isTrue(componentCanvas.initialized);
const componentTest = new ComponentTest();
assert.isTrue(componentTest.initialized);
const componentGeometry = new ComponentGeometry();
assert.isTrue(componentGeometry.initialized);
const componentBufferGeometry = new ComponentBufferGeometry();
@ -122,7 +124,6 @@ describe('R3 Tests', () => {
const runtimeControlKit = new RuntimeControlKit();
const runtimeGraphics = new RuntimeGraphics();
const runtimeThree = new RuntimeThree();
const runtimeImage = new RuntimeImage();
const runtimePhysics = new RuntimePhysics();
const runtimeBullet = new RuntimeBullet();
const runtimeSocket = new RuntimeSocket();

View File

@ -1 +1 @@
3.0.348
3.0.363