two tests passing :)

master
Theunis J. Botha 2021-10-01 08:36:52 +02:00
parent 70b7dcf438
commit 4589ecb059
32 changed files with 421 additions and 210 deletions

View File

@ -12,7 +12,7 @@ r3 create Entity entity_base ./r3-entity/
r3 create EntitySlider entity_extends Entity ./r3-entity/
r3 create Event base ./
r3 create Project object_extends R3Object ./r3-object/
r3 create R3 r3_base ./
r3 create R3 base ./
r3 create RuntimeBullet runtime_extends RuntimePhysics ./r3-runtime/
r3 create RuntimeCodeMirror runtime_extends RuntimeCoder ./r3-runtime/
r3 create RuntimeCoder runtime_base ./r3-runtime/

88
dist/r3.js vendored
View File

@ -1,7 +1,6 @@
class R3 {
static Version = '3.0.140';
static CompileDate = '2021 Oct 01 - 06:06:01 am';
}
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
class System {
@ -2945,11 +2944,11 @@ class Project extends R3Object {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -2974,7 +2973,7 @@ class Project extends R3Object {
);
}
console.log('Started transient system: CLASS_NAME');
console.log('Started transient system: Project');
}
@ -2986,7 +2985,7 @@ class Project extends R3Object {
this.started = false;
console.log('Stopped transient system: CLASS_NAME');
console.log('Stopped transient system: Project');
}
@ -3443,11 +3442,11 @@ class EntitySlider extends Entity {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -3929,11 +3928,11 @@ class ComponentCode extends Component {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -4131,11 +4130,11 @@ class ComponentDOM extends Component {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -4402,11 +4401,11 @@ class ComponentCanvas extends ComponentDOM {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -4682,11 +4681,11 @@ class ComponentGraphics extends Component {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -5001,11 +5000,11 @@ class ComponentImage extends ComponentGraphics {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -5435,11 +5434,11 @@ class ComponentMaterial extends ComponentGraphics {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -5643,11 +5642,11 @@ class ComponentMesh extends ComponentGraphics {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -5851,11 +5850,11 @@ class ComponentTexture extends ComponentGraphics {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -6045,11 +6044,11 @@ class ComponentInput extends Component {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -6303,11 +6302,11 @@ class ComponentTouch extends ComponentInput {
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -7627,8 +7626,6 @@ R3.Material = R3Object.Component.Graphics.Material;
R3.Mesh = R3Object.Component.Graphics.Mesh;
R3.Texture = R3Object.Component.Graphics.Texture;
R3.Touch = R3Object.Component.Input.Touch;
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
R3.System.DOM.Start();
R3.System.Input.Start();
R3.System.Linking.Start();
@ -7636,3 +7633,30 @@ R3.System.Render.Start();
R3.System.Runtime.Start();
R3.System.Socket.Start();
R3.System.Storage.Start();
R3.System = System;
R3.Runtime = Runtime;
R3.Event = Event;
R3.Utils = Utils;
R3.Object = R3Object;
R3.Project = Project;
R3.Entity = Entity;
R3.Component = Component;
R3.Code = R3Object.Component.Code;
R3.Canvas = R3Object.Component.DOM.Canvas;
R3.Image = R3Object.Component.Graphics.Image;
R3.Material = R3Object.Component.Graphics.Material;
R3.Mesh = R3Object.Component.Graphics.Mesh;
R3.Texture = R3Object.Component.Graphics.Texture;
R3.Touch = R3Object.Component.Input.Touch;
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
R3.System.DOM.Start();
R3.System.Input.Start();
R3.System.Linking.Start();
R3.System.Render.Start();
R3.System.Runtime.Start();
R3.System.Socket.Start();
R3.System.Storage.Start();

View File

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

103
r3.php
View File

@ -1401,6 +1401,7 @@ function generateR3($nodes, $graph)
foreach ($nodes as $node) {
if (
$node->parent === null ||
$node->parent->parent === null || //i.e. is a base class
$node->parent->name === 'Event' || //i.e. extends Event directly
$node->parent->name === 'R3Object' //i.e. extends Object directly
@ -1409,8 +1410,11 @@ function generateR3($nodes, $graph)
foreach ($modifiedPaths as $modifiedPath) {
$file = preg_replace($modifiedPath, '', $file);
}
array_push($imports, "const " . $node->name . ' = require(\'' . $file . "');");
array_push($defines, 'R3.' . $node->nameSpaceClassName . ' = ' . $node->name);
array_push($imports, "const " . $node->name . " = require('" . $file . "');");
if ($node->parent !== null) {
array_push($defines, 'R3.' . $node->nameSpaceClassName . ' = ' . $node->name);
}
}
}
@ -1425,55 +1429,51 @@ function generateR3($nodes, $graph)
}
}
$r3File = 'src/r3/r3-r3.js';
$r3Index = 'src/r3/index.js';
save($r3File, getTokens(['CUSTOM']));
save($r3Index, getTokens(['CUSTOM']));
$tokens = loadSaved($r3File . '.saved', getTokens(['CUSTOM']));
$tokens = loadSaved($r3Index . '.saved', getTokens(['CUSTOM']));
$template = file_get_contents('src/templates/r3_index.template');
file_put_contents($r3Index, $template);
$template = file_get_contents('src/templates/r3_base.template');
$version = file_get_contents('version');
$template = str_replace('DATE', date("Y M d - H:i:s a"), $template);
$template = str_replace('VERSION', $version, $template);
file_put_contents($r3File, $template);
$packageJson = file_get_contents('package.json');
$packageJson = preg_replace('/(.*version.*: ").*(".*)/', '${1}' . $version . '${2}', $packageJson);
file_put_contents('package.json', $packageJson);
updateSection($r3File, 'GENERATED_IMPORTS', implode("\n", $imports));
updateSection($r3File, 'GENERATED_DEFINES', implode(";\n", $defines) . ";");
$r3js = 'src/r3/r3.js';
$contents = file_get_contents($r3js);
$contents = str_replace(' = \'__COMPILE_DATE__\'', ' = \'' . date("Y M d - H:i:s a") . '\'', $contents);
$contents = str_replace(' = \'__VERSION__\'', ' = \'' . $version . '\'', $contents);
file_put_contents($r3js, $contents);
if (in_array('CUSTOM_CONVENIENT_DEFINES', array_keys($tokens))) {
updateSection($r3File, 'CUSTOM_CONVENIENT_DEFINES', $tokens['CUSTOM_CONVENIENT_DEFINES']);
}
$indexFile = 'src/r3/index.js';
$template = file_get_contents('src/templates/index.template');
file_put_contents($indexFile, $template);
$imports = ['const R3 = require(\'./r3-r3.js\');'];
$exports = 'module.exports = R3;';
$indexBody = [];
array_push($indexBody, "console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);");
$systemBody = [];
foreach ($nodes as $node) {
/**
* Node $node
*/
if (preg_match('/\bSystem\w+\b/', $node->name)){
array_push($indexBody, 'R3.' . $node->nameSpace . ".Start();");
array_push($systemBody, 'R3.' . $node->nameSpace . ".Start();");
}
}
updateSection($indexFile, 'GENERATED_IMPORTS', implode("\n", $imports));
updateSection($indexFile, 'GENERATED_INDEX_BODY', implode("\n", $indexBody));
updateSection($indexFile, 'GENERATED_EXPORTS', $exports);
if (in_array('CUSTOM_DEFINES', array_keys($tokens))) {
updateSection($r3Index, 'CUSTOM_DEFINES', $tokens['CUSTOM_DEFINES']);
}
updateSection($r3Index, 'GENERATED_IMPORTS', implode("\n", $imports));
updateSection($r3Index, 'GENERATED_DEFINES', implode(";\n", $defines) . ";");
updateSection($r3Index, 'GENERATED_SYSTEM', implode("\n", $systemBody));
updateSection($r3Index, 'GENERATED_EXPORTS', $exports);
}
@ -1590,8 +1590,8 @@ function generateR3Dist($nodes)
global $graph;
$r3jsFile = 'dist/r3.js';
$r3jsSource = 'src/r3/r3-r3.js';
$r3jsBaseTemplate = 'src/templates/r3_base.template';
$r3jsSource = 'src/r3/index.js';
$r3IndexTemplate = 'src/templates/r3_index.template';
$r3js = fopen($r3jsFile, "w");
ftruncate($r3js, 0);
@ -1602,7 +1602,7 @@ function generateR3Dist($nodes)
// file_put_contents('package.json', $packageJson);
$version = file_get_contents('version');
$template = file_get_contents($r3jsBaseTemplate);
$template = file_get_contents($r3IndexTemplate);
$template = str_replace('DATE', date("Y M d - H:i:s a"), $template);
$template = str_replace('VERSION', $version, $template);
fwrite($r3js, $template);
@ -1727,27 +1727,34 @@ function generateR3Dist($nodes)
function updateParentSystems($nodes)
{
foreach ($nodes as $node) {
if (preg_match('/(System|Component|Entity|Runtime)/', $node->name)) {
$className = $node->name;
$parentName = $node->parent->name;
if ($node->parent->parent === null) {
/**
* We are working with the base system class
*/
$parentName = $node->name;
}
$className = $node->name;
if ($node->parent === null) {
$contents = file_get_contents($node->file);
$contents = preg_replace('/PARENT_SYSTEM/', $parentName, $contents);
$contents = preg_replace('/CLASS_NAME/', $className, $contents);
$contents = preg_replace('/SYSTEM_NAME/', $className, $contents);
file_put_contents($node->file, $contents);
continue;
}
$parentName = $node->parent->name;
if ($node->parent->parent === null) {
/**
* We are working with the base system class
*/
$parentName = $node->name;
}
$contents = file_get_contents($node->file);
$contents = preg_replace('/PARENT_SYSTEM/', $parentName, $contents);
$contents = preg_replace('/CLASS_NAME/', $className, $contents);
$contents = preg_replace('/SYSTEM_NAME/', $className, $contents);
file_put_contents($node->file, $contents);
}
}
function buildNodeList($file)
@ -2096,8 +2103,8 @@ if ($argv[2] == 'build-dist') {
);
$nodes = $graph->walk();
// Remove R3 (first node) from the list
array_shift($nodes);
// // Remove R3 (first node) from the list
// array_shift($nodes);
updateParentSystems($nodes);

View File

@ -1,9 +1,39 @@
//GENERATED_IMPORTS_START
const R3 = require('./r3-r3.js');
const R3 = require('./r3.js');
const System = require('./r3-system/');
const Runtime = require('./r3-runtime/');
const Event = require('./r3-event.js');
const Utils = require('./r3-utils.js');
const R3Object = require('./r3-object/');
const Project = require('./r3-object/r3-project.js');
const Entity = require('./r3-entity/');
const Component = require('./r3-component/');
//GENERATED_IMPORTS_END
//GENERATED_INDEX_BODY_START
//GENERATED_DEFINES_START
R3.System = System;
R3.Runtime = Runtime;
R3.Event = Event;
R3.Utils = Utils;
R3.Object = R3Object;
R3.Project = Project;
R3.Entity = Entity;
R3.Component = Component;
R3.Code = R3Object.Component.Code;
R3.Canvas = R3Object.Component.DOM.Canvas;
R3.Image = R3Object.Component.Graphics.Image;
R3.Material = R3Object.Component.Graphics.Material;
R3.Mesh = R3Object.Component.Graphics.Mesh;
R3.Texture = R3Object.Component.Graphics.Texture;
R3.Touch = R3Object.Component.Input.Touch;
//GENERATED_DEFINES_END
//CUSTOM_DEFINES_START
//CUSTOM_DEFINES_END
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
//GENERATED_SYSTEM_START
R3.System.DOM.Start();
R3.System.Input.Start();
R3.System.Linking.Start();
@ -11,8 +41,6 @@ R3.System.Render.Start();
R3.System.Runtime.Start();
R3.System.Socket.Start();
R3.System.Storage.Start();
//GENERATED_INDEX_BODY_END
//GENERATED_SYSTEM_END
//GENERATED_EXPORTS_START
module.exports = R3;
//GENERATED_EXPORTS_END

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const ComponentDOM = require('./r3-component-d-o-m.js');
/**
@ -278,11 +283,11 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
/**
@ -224,11 +229,11 @@ class ComponentCode extends Component {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
/**
@ -235,11 +240,11 @@ class ComponentDOM extends Component {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
/**
@ -227,11 +232,11 @@ class ComponentGraphics extends Component {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -368,11 +373,11 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
/**
@ -227,11 +232,11 @@ class ComponentInput extends Component {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -242,11 +247,11 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -242,11 +247,11 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -242,11 +247,11 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const ComponentInput = require('./r3-component-input.js');
/**
@ -289,11 +294,11 @@ class ComponentTouch extends ComponentInput {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,5 +1,10 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('../r3-event.js');
const R3Object = require('../r3-object/r3-object.js');
/**

View File

@ -389,11 +389,11 @@ class EntitySlider extends Entity {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,4 +1,9 @@
const Utils = require('./r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
const Utils = require('./r3-utils.js');
//CUSTOM_IMPORTS_END
/**

View File

@ -217,11 +217,11 @@ class Project extends R3Object {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}
@ -255,7 +255,7 @@ class Project extends R3Object {
);
}
console.log('Started transient system: CLASS_NAME');
console.log('Started transient system: Project');
//GENERATED_START_METHOD_END
//CUSTOM_START_METHOD_START
@ -282,7 +282,7 @@ class Project extends R3Object {
this.started = false;
console.log('Stopped transient system: CLASS_NAME');
console.log('Stopped transient system: Project');
//GENERATED_STOP_METHOD_END
//CUSTOM_STOP_METHOD_START

View File

@ -1,38 +0,0 @@
class R3 {
static Version = '3.0.140';
static CompileDate = '2021 Oct 01 - 06:06:01 am';
}
//GENERATED_IMPORTS_START
const System = require('./r3-system/');
const Runtime = require('./r3-runtime/');
const Event = require('./r3-event.js');
const Utils = require('./r3-utils.js');
const R3Object = require('./r3-object/');
const Project = require('./r3-object/r3-project.js');
const Entity = require('./r3-entity/');
const Component = require('./r3-component/');
//GENERATED_IMPORTS_END
//GENERATED_DEFINES_START
R3.System = System;
R3.Runtime = Runtime;
R3.Event = Event;
R3.Utils = Utils;
R3.Object = R3Object;
R3.Project = Project;
R3.Entity = Entity;
R3.Component = Component;
R3.Code = R3Object.Component.Code;
R3.Canvas = R3Object.Component.DOM.Canvas;
R3.Image = R3Object.Component.Graphics.Image;
R3.Material = R3Object.Component.Graphics.Material;
R3.Mesh = R3Object.Component.Graphics.Mesh;
R3.Texture = R3Object.Component.Graphics.Texture;
R3.Touch = R3Object.Component.Input.Touch;
//GENERATED_DEFINES_END
//CUSTOM_CONVENIENT_DEFINES_START
//CUSTOM_CONVENIENT_DEFINES_END
module.exports = R3;

View File

@ -1,5 +1,8 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
/**

View File

@ -1,4 +1,8 @@
const Event = require('./r3-event');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
/**

108
src/r3/r3.js Normal file
View File

@ -0,0 +1,108 @@
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
/**
GENERATED_INHERITED_START
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END
CUSTOM_STATIC_OPTIONS_START
Version='__VERSION__' - Current R3 version
CompileDate='__COMPILE_DATE__' - Current compile date of R3
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 R3 {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
//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
//CUSTOM_AFTER_INIT_START
//CUSTOM_AFTER_INIT_END
}
//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
/**
* static Version - Current R3 version
*/
R3.Version = '3.0.171';
/**
* static CompileDate - Current compile date of R3
*/
R3.CompileDate = '2021 Oct 01 - 08:36:23 am';
//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 = R3;

View File

@ -1,5 +1,8 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
/**

View File

@ -1,5 +1,10 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('../r3-event.js');
const R3Object = require('../r3-object/r3-object.js');
/**

View File

@ -1,5 +1,10 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**

View File

@ -1,10 +1,10 @@
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component && this.initialized) {
if (this instanceof Component && this.initialized) {
this.createInstance();
}
if (this instanceof R3.Entity && this.initialized && !this.started) {
if (this instanceof Entity && this.initialized && !this.started) {
this.start();
}

View File

@ -1,15 +0,0 @@
class R3 {
static Version = 'VERSION';
static CompileDate = 'DATE';
}
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//GENERATED_DEFINES_START
//GENERATED_DEFINES_END
//CUSTOM_CONVENIENT_DEFINES_START
//CUSTOM_CONVENIENT_DEFINES_END
module.exports = R3;

View File

@ -0,0 +1,15 @@
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//GENERATED_DEFINES_START
//GENERATED_DEFINES_END
//CUSTOM_DEFINES_START
//CUSTOM_DEFINES_END
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
//GENERATED_SYSTEM_START
//GENERATED_SYSTEM_END
module.exports = R3;

View File

@ -80,6 +80,7 @@ GENERATED_STOP_METHOD
GENERATED_STOP_METHOD_AFTER
GENERATED_SUBSCRIBE_METHOD
GENERATED_SUBSCRIBE_METHOD_AFTER
GENERATED_SYSTEM
GENERATED_TEMPLATE_METHODS
GENERATED_TEMPLATE_OPTIONS_INIT
GENERATED_TEMPLATE_STATIC_METHODS
@ -100,14 +101,15 @@ CUSTOM_BEFORE_STATIC_SYSTEM_STOP
CUSTOM_BEFORE_SYSTEM_START
CUSTOM_BEFORE_SYSTEM_STOP
CUSTOM_BUILD_INSTANCE_METHOD
CUSTOM_CONVENIENT_DEFINES
CUSTOM_CREATE_INSTANCE_METHOD
CUSTOM_DEFINES
CUSTOM_DISPOSE_INSTANCE_METHOD
CUSTOM_DISPOSE_METHOD
CUSTOM_EMIT_METHOD
CUSTOM_EVENT_LISTENERS
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS
CUSTOM_IMPLEMENTATION
CUSTOM_IMPORTS
CUSTOM_INITIALIZE_METHOD
CUSTOM_INSTANCE_OPTIONS_MAPPING
CUSTOM_METHOD_NAME_UPPERCASE_METHOD

View File

@ -4,7 +4,7 @@ const Event = require('../src/r3/r3-event.js');
describe('R3 Tests', () => {
it (
'Tests R3 Loads',
'R3 loads',
() => {
const R3 = require('../src/r3/');
@ -19,16 +19,16 @@ describe('R3 Tests', () => {
);
it (
'Tests creation of all components succeed',
'Creation of all components succeed',
() => {
const R3 = require('../src/r3/');
const Component = require('../src/r3/r3-component');
assert.typeOf(R3.Version, 'string');
assert.typeOf(R3.CompileDate, 'string');
console.log('R3 Version : ' + R3.Version);
console.log('R3 Compile Date : ' + R3.CompileDate);
for (let Constructor in Component) {
if (Component.hasOwnProperty(Constructor) && typeof Component[Constructor] === 'function') {
let component = new Component[Constructor]();
}
}
}
);

View File

@ -1 +1 @@
3.0.140
3.0.171