all tests passing

master
Theunis J. Botha 2021-10-01 12:40:04 +02:00
parent 40e85bf6d4
commit 967ee31957
39 changed files with 411 additions and 140 deletions

94
dist/r3.js vendored
View File

@ -1,7 +1,5 @@
//GENERATED_SOURCE_START
class R3 {
constructor(options) {
@ -19,12 +17,12 @@ class R3 {
/**
* static Version - Current R3 version
*/
R3.Version = '3.0.171';
R3.Version = '3.0.202';
/**
* static CompileDate - Current compile date of R3
*/
R3.CompileDate = '2021 Oct 01 - 08:36:23 am';
R3.CompileDate = '2021 Oct 01 - 12:39:24 pm';
class System {
@ -601,7 +599,7 @@ class SystemLinking extends System {
*/
static OnObjectCreated(object) {
console.log('object created');
console.log('Object created : ' + object.name);
}
@ -688,7 +686,7 @@ class SystemLinking extends System {
*/
static OnObjectPropertyUpdate(object) {
let {value, property} = object;
let {value, property, r3object} = object;
// object = object.object;
@ -706,11 +704,11 @@ class SystemLinking extends System {
*/
if (value.length === 0) {
if (object[property] instanceof Array) {
for (let i = 0; i < object[property].length; i++) {
if (object[property][i] instanceof R3.Object) {
object.dirty = true;
Utils.RemoveFromArray(object[property][i].parents, object);
if (r3object[property] instanceof Array) {
for (let i = 0; i < r3object[property].length; i++) {
if (r3object[property][i] instanceof R3Object) {
r3object.dirty = true;
Utils.RemoveFromArray(r3object[property][i].parents, r3object);
}
}
}
@ -722,16 +720,16 @@ class SystemLinking extends System {
*/
for (let i = 0; i < value.length; i++) {
if (value[i] instanceof R3.Object) {
Utils.PushUnique(value[i].parents, object);
if (value[i] instanceof R3Object) {
Utils.PushUnique(value[i].parents, r3object);
}
}
}
}
if (value instanceof R3.Object) {
Utils.PushUnique(value.parents, object);
if (value instanceof R3Object) {
Utils.PushUnique(value.parents, r3object);
}
/**
@ -739,23 +737,23 @@ class SystemLinking extends System {
* components (if available)
*/
if (value === null || typeof value === 'undefined') {
if (object[property] instanceof R3.Object) {
object.dirty = true;
Utils.RemoveFromArray(object[property].parents, object);
if (r3object[property] instanceof R3Object) {
r3object.dirty = true;
Utils.RemoveFromArray(r3object[property].parents, r3object);
}
}
if (!object.underConstruction) {
if (!r3object.underConstruction) {
if (object.initialized) {
if (r3object.initialized) {
/**
* Check if this object will still be initialized after this assignment completes
*/
object.setInitialized(property, value);
if (!object.initialized) {
r3object.setInitialized(property, value);
if (!r3object.initialized) {
//We set this object back to initialized because it is still initialized - it WILL be not initialized in the future
object.initialized = true;
object.stop();
r3object.initialized = true;
r3object.stop();
}
}
}
@ -770,9 +768,9 @@ class SystemLinking extends System {
*/
static OnObjectPropertyUpdated(object) {
// let {object} = object;
let {r3object} = object;
if (!object.underConstruction) {
if (!r3object.underConstruction) {
/**
* At this point - the object entity would have been brought to a stop
@ -781,12 +779,12 @@ class SystemLinking extends System {
* We can safely clear the dirty flag.
*/
if (object.dirty) {
object.dirty = false;
if (r3object.dirty) {
r3object.dirty = false;
}
object.initializeDepth = 0;
object.initialize();
r3object.initializeDepth = 0;
r3object.initialize();
}
}
@ -2639,7 +2637,7 @@ class R3Object extends Event {
* name - Each Object has a name
*/
if (typeof options.name === 'undefined') {
options.name = 'Object ' + options.id;
options.name = this.constructor.name + '(' + options.id + ')';
}
/**
* dirty - When dirty is true, it means that this object is in transition from having a child Object to
@ -3248,9 +3246,9 @@ Entity.MAX_ENTITY = 0x1;
<no static methods>
images=[R3.Image] - We need a list of at least one Image which to slide
canvas=R3.Canvas - We need a Canvas to attach our Input events
touch=R3.Touch - We need a Touch Component to respond to TOUCH Events
images=[Image] - We need a list of at least one Image which to slide
canvas=Canvas - We need a Canvas to attach our Input events
touch=Touch - We need a Touch Component to respond to TOUCH Events
**/
@ -3334,7 +3332,7 @@ class EntitySlider extends Entity {
/**
* images - We need a list of at least one Image which to slide
*/
options.required.images = [R3.Image];
options.required.images = [Image];
this.imagesBackup = options.images;
Object.defineProperty(
this,
@ -3346,7 +3344,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'images',
value : x
}
@ -3355,7 +3353,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'images',
value : x
}
@ -3369,7 +3367,7 @@ class EntitySlider extends Entity {
) /**
* canvas - We need a Canvas to attach our Input events
*/
options.required.canvas = R3.Canvas;
options.required.canvas = Canvas;
this.canvasBackup = options.canvas;
Object.defineProperty(
this,
@ -3381,7 +3379,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -3390,7 +3388,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -3404,7 +3402,7 @@ class EntitySlider extends Entity {
) /**
* touch - We need a Touch Component to respond to TOUCH Events
*/
options.required.touch = R3.Touch;
options.required.touch = Touch;
this.touchBackup = options.touch;
Object.defineProperty(
this,
@ -3416,7 +3414,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'touch',
value : x
}
@ -3425,7 +3423,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'touch',
value : x
}
@ -6221,7 +6219,7 @@ class ComponentInput extends Component {
<no static methods>
canvas=R3.Canvas
canvas=ComponentCanvas
**/
@ -6264,7 +6262,7 @@ class ComponentTouch extends ComponentInput {
/**
* canvas - No comment
*/
options.required.canvas = R3.Canvas;
options.required.canvas = ComponentCanvas;
this.canvasBackup = options.canvas;
Object.defineProperty(
this,
@ -6276,7 +6274,7 @@ class ComponentTouch extends ComponentInput {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -6285,7 +6283,7 @@ class ComponentTouch extends ComponentInput {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -7587,8 +7585,6 @@ class Utils {
}
//GENERATED_SOURCE_END
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
Component.Code = ComponentCode;

View File

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

71
r3.php
View File

@ -1308,6 +1308,45 @@ function generateStaticEventListenerMethods($file, $tokens)
}
function generateImports($file, $tokens, $command)
{
$updates = [];
if (
array_key_exists('CUSTOM_REQUIRED_COMPONENTS', $tokens) &&
sizeof($tokens['CUSTOM_REQUIRED_COMPONENTS']) > 0
) {
array_push($updates, "const Event = require('../r3-event.js');\n");
}
if (
array_key_exists('TEMPLATE_METHODS', $tokens) &&
sizeof($tokens['TEMPLATE_METHODS']) > 0
) {
foreach ($tokens['TEMPLATE_METHODS'] as $method) {
if (preg_match('/initialize\(\)/', $method)) {
if (!preg_match('/ Component/', $command)) {
array_push($updates, "const Component = require('../r3-component/r3-component.js');\n");
}
if (!preg_match('/ Entity /', $command)) {
array_push($updates, "const Entity = require('../r3-entity/r3-entity.js');\n");
}
}
}
}
if (sizeof($updates) === 0) {
return;
}
updateSection($file, 'GENERATED_IMPORTS', $updates);
}
function generateMethods($file, $tokens, $token, $section)
{
@ -1323,7 +1362,7 @@ function generateMethods($file, $tokens, $token, $section)
}
function buildImportsAndBody(&$imports, &$body, $node, $type, $nameSpace)
function buildImportsAndBody(&$imports, &$body, &$tests, &$testImports, $node, $type, $nameSpace)
{
$originalNameSpace = $nameSpace;
@ -1333,13 +1372,26 @@ function buildImportsAndBody(&$imports, &$body, $node, $type, $nameSpace)
$nameSpace = $originalNameSpace . '.' . $child->nameSpaceClassName;
$file = str_replace('src/r3/r3-' . str_replace('r3-', '', strtolower(from_camel_case($type,'-'))), '.', $child->file);
$file = preg_replace('/src\/r3/','..',$file);
$important = true;
if (preg_match('/src\/r3/', $file)) {
$important = false;
$file = preg_replace('/src\/r3/','..',$file);
}
array_push($imports, "const " . $child->name . ' = require(\'' . $file . "');");
array_push($body, "$nameSpace = " . $child->name . ';');
if ($important) {
array_push($testImports, "const " . $child->name . ' = require(\'../src/r3/r3-' . str_replace('r3object','object', strtolower($type)) . '/' . $file . "');");
array_push($tests, "\t\t\tconst " . lcfirst($child->name) . " = new " . $child->name . '();');
}
$child->nameSpace = $nameSpace;
buildImportsAndBody($imports, $body, $child, $type, $nameSpace);
buildImportsAndBody($imports, $body, $tests, $testImports, $child, $type, $nameSpace);
}
}
@ -1355,8 +1407,10 @@ function generateIndex($types)
foreach ($types as $type) {
$imports = [];
$testImports = [];
$body = [];
$exports = [];
$tests = [];
$nodes = $graph->walk();
@ -1368,7 +1422,7 @@ function generateIndex($types)
array_push($imports, "const " . $node->name . ' = require(\'' . $file . "');");
buildImportsAndBody($imports, $body, $node, $type, $type);
buildImportsAndBody($imports, $body, $tests, $testImports,$node, $type, $type);
}
}
@ -1382,6 +1436,11 @@ function generateIndex($types)
updateSection($indexFile, 'GENERATED_IMPORTS', implode("\n", $imports));
updateSection($indexFile, 'GENERATED_INDEX_BODY', implode("\n", $body));
updateSection($indexFile, 'GENERATED_EXPORTS', implode("\n", $exports));
$testFile = 'test/R3.test.js';
updateSection($testFile, 'GENERATED_' . to_upper_underscore($type) . '_CREATE', implode("\n", $tests));
updateSection($testFile, 'GENERATED_' . to_upper_underscore($type) . '_IMPORTS', implode("\n", $testImports));
}
}
@ -1659,7 +1718,7 @@ function generateR3Dist($nodes)
fclose($r3jsDistPointer);
deleteSavedFile($indexFile . '.saved');
deleteSavedFile($r3jsIndex . '.saved');
/**
* Now start cleaning up the file
@ -1984,6 +2043,8 @@ foreach ($files as $file) {
echo "Generating Methods\n";
generateImports($file, $tokens, $argv[3]);
generateMethods($file, $tokens, 'TEMPLATE_METHODS', 'GENERATED_TEMPLATE_METHODS');
generateMethods($file, $tokens, 'CUSTOM_METHODS', 'GENERATED_METHODS');

View File

@ -1,10 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const ComponentDOM = require('./r3-component-d-o-m.js');
/**

View File

@ -1,11 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
const Component = require('../r3-component/r3-component.js');
/**

View File

@ -1,11 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
const Component = require('../r3-component/r3-component.js');
/**

View File

@ -1,11 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
const Component = require('../r3-component/r3-component.js');
/**

View File

@ -1,10 +1,12 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
const Utils = require('../r3-utils.js');
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**

View File

@ -1,11 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('./r3-component.js');
const Component = require('../r3-component/r3-component.js');
/**

View File

@ -1,10 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**

View File

@ -1,10 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**

View File

@ -1,10 +1,11 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**

View File

@ -1,10 +1,13 @@
//GENERATED_IMPORTS_START
const Event = require('../r3-event.js');
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
const ComponentCanvas = require('../r3-component/r3-component-canvas.js');
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const ComponentInput = require('./r3-component-input.js');
/**
@ -131,7 +134,7 @@ const ComponentInput = require('./r3-component-input.js');
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
canvas=R3.Canvas
canvas=ComponentCanvas
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
@ -215,7 +218,7 @@ class ComponentTouch extends ComponentInput {
/**
* canvas - No comment
*/
options.required.canvas = R3.Canvas;
options.required.canvas = ComponentCanvas;
this.canvasBackup = options.canvas;
Object.defineProperty(
this,
@ -227,7 +230,7 @@ class ComponentTouch extends ComponentInput {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -236,7 +239,7 @@ class ComponentTouch extends ComponentInput {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}

View File

@ -1,4 +1,5 @@
//GENERATED_IMPORTS_START
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START

View File

@ -1,5 +1,14 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
//GENERATED_IMPORTS_START
const Event = require('../r3-event.js');
const Component = require('../r3-component/r3-component.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
const Image = require('../r3-component/r3-component-image.js');
const Canvas = require('../r3-component/r3-component-canvas.js');
const Touch = require('../r3-component/r3-component-touch.js');
//CUSTOM_IMPORTS_END
const Entity = require('./r3-entity.js');
/**
@ -119,9 +128,9 @@ const Entity = require('./r3-entity.js');
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
images=[R3.Image] - We need a list of at least one Image which to slide
canvas=R3.Canvas - We need a Canvas to attach our Input events
touch=R3.Touch - We need a Touch Component to respond to TOUCH Events
images=[Image] - We need a list of at least one Image which to slide
canvas=Canvas - We need a Canvas to attach our Input events
touch=Touch - We need a Touch Component to respond to TOUCH Events
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
@ -240,7 +249,7 @@ class EntitySlider extends Entity {
/**
* images - We need a list of at least one Image which to slide
*/
options.required.images = [R3.Image];
options.required.images = [Image];
this.imagesBackup = options.images;
Object.defineProperty(
this,
@ -252,7 +261,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'images',
value : x
}
@ -261,7 +270,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'images',
value : x
}
@ -275,7 +284,7 @@ class EntitySlider extends Entity {
) /**
* canvas - We need a Canvas to attach our Input events
*/
options.required.canvas = R3.Canvas;
options.required.canvas = Canvas;
this.canvasBackup = options.canvas;
Object.defineProperty(
this,
@ -287,7 +296,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -296,7 +305,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'canvas',
value : x
}
@ -310,7 +319,7 @@ class EntitySlider extends Entity {
) /**
* touch - We need a Touch Component to respond to TOUCH Events
*/
options.required.touch = R3.Touch;
options.required.touch = Touch;
this.touchBackup = options.touch;
Object.defineProperty(
this,
@ -322,7 +331,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'touch',
value : x
}
@ -331,7 +340,7 @@ class EntitySlider extends Entity {
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'touch',
value : x
}

View File

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

View File

@ -1,3 +1,11 @@
//GENERATED_IMPORTS_START
const Component = require('../r3-component/r3-component.js');
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
@ -64,7 +72,7 @@ const Utils = require('.././r3-utils');
TEMPLATE_OPTIONS_START
id=Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely identifies it everywhere (client and server side)
name='Object ' + options.id - Each Object has a name
name=this.constructor.name + '(' + options.id + ')' - Each Object has a name
dirty=false - When dirty is true, it means that this object is in transition from having a child Object to not having this child Object, and will probably end up in an uninitialized state. During the next few clock cycles this child Object will have its parent reference to this Object removed.
initialized=false - A boolean which indicates whether or not this Object has initialized
initializeDepth=0 - The amount of times this Object passed through initialize() functions
@ -129,7 +137,7 @@ class R3Object extends Event {
* name - Each Object has a name
*/
if (typeof options.name === 'undefined') {
options.name = 'Object ' + options.id;
options.name = this.constructor.name + '(' + options.id + ')';
}
/**
* dirty - When dirty is true, it means that this object is in transition from having a child Object to

View File

@ -1,3 +1,11 @@
//GENERATED_IMPORTS_START
const Component = require('../r3-component/r3-component.js');
const Entity = require('../r3-entity/r3-entity.js');
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const R3Object = require('./r3-object.js');

View File

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

View File

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

View File

@ -1,5 +1,12 @@
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
const R3Object = require('../r3-object/r3-object.js');
const Utils = require('../r3-utils.js');
//CUSTOM_IMPORTS_END
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('./r3-system.js');
/**
@ -254,7 +261,7 @@ class SystemLinking extends System {
//GENERATED_STATIC_ON_OBJECT_CREATED_METHOD_END
//CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_START
console.log('object created');
console.log('Object created : ' + object.name);
//CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_END
}
@ -366,7 +373,7 @@ class SystemLinking extends System {
//GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_END
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_START
let {value, property} = object;
let {value, property, r3object} = object;
// object = object.object;
@ -384,11 +391,11 @@ class SystemLinking extends System {
*/
if (value.length === 0) {
if (object[property] instanceof Array) {
for (let i = 0; i < object[property].length; i++) {
if (object[property][i] instanceof R3.Object) {
object.dirty = true;
Utils.RemoveFromArray(object[property][i].parents, object);
if (r3object[property] instanceof Array) {
for (let i = 0; i < r3object[property].length; i++) {
if (r3object[property][i] instanceof R3Object) {
r3object.dirty = true;
Utils.RemoveFromArray(r3object[property][i].parents, r3object);
}
}
}
@ -400,16 +407,16 @@ class SystemLinking extends System {
*/
for (let i = 0; i < value.length; i++) {
if (value[i] instanceof R3.Object) {
Utils.PushUnique(value[i].parents, object);
if (value[i] instanceof R3Object) {
Utils.PushUnique(value[i].parents, r3object);
}
}
}
}
if (value instanceof R3.Object) {
Utils.PushUnique(value.parents, object);
if (value instanceof R3Object) {
Utils.PushUnique(value.parents, r3object);
}
/**
@ -417,23 +424,23 @@ class SystemLinking extends System {
* components (if available)
*/
if (value === null || typeof value === 'undefined') {
if (object[property] instanceof R3.Object) {
object.dirty = true;
Utils.RemoveFromArray(object[property].parents, object);
if (r3object[property] instanceof R3Object) {
r3object.dirty = true;
Utils.RemoveFromArray(r3object[property].parents, r3object);
}
}
if (!object.underConstruction) {
if (!r3object.underConstruction) {
if (object.initialized) {
if (r3object.initialized) {
/**
* Check if this object will still be initialized after this assignment completes
*/
object.setInitialized(property, value);
if (!object.initialized) {
r3object.setInitialized(property, value);
if (!r3object.initialized) {
//We set this object back to initialized because it is still initialized - it WILL be not initialized in the future
object.initialized = true;
object.stop();
r3object.initialized = true;
r3object.stop();
}
}
}
@ -454,9 +461,9 @@ class SystemLinking extends System {
//GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_END
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_START
// let {object} = object;
let {r3object} = object;
if (!object.underConstruction) {
if (!r3object.underConstruction) {
/**
* At this point - the object entity would have been brought to a stop
@ -465,12 +472,12 @@ class SystemLinking extends System {
* We can safely clear the dirty flag.
*/
if (object.dirty) {
object.dirty = false;
if (r3object.dirty) {
r3object.dirty = false;
}
object.initializeDepth = 0;
object.initialize();
r3object.initializeDepth = 0;
r3object.initialize();
}
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_END

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -90,12 +90,12 @@ class R3 {
/**
* static Version - Current R3 version
*/
R3.Version = '3.0.171';
R3.Version = '3.0.202';
/**
* static CompileDate - Current compile date of R3
*/
R3.CompileDate = '2021 Oct 01 - 08:36:23 am';
R3.CompileDate = '2021 Oct 01 - 12:39:24 pm';
//GENERATED_STATIC_OPTIONS_INIT_END

View File

@ -4,7 +4,7 @@
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Entity = require('../r3-entity/r3-entity.js');
const Component = require('../r3-component/r3-component.js');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**

View File

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

View File

@ -1,5 +1,9 @@
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 EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**

View File

@ -13,7 +13,7 @@
Event.Emit(
Event.OBJECT_PROPERTY_UPDATE,
{
object : this,
r3object : this,
property : 'KEY',
value : x
}
@ -22,7 +22,7 @@
Event.Emit(
Event.OBJECT_PROPERTY_UPDATED,
{
object : this,
r3object : this,
property : 'KEY',
value : x
}

View File

@ -1,3 +1,9 @@
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
@ -9,7 +15,7 @@ const Utils = require('INCLUDE_PATH/r3-utils');
TEMPLATE_OPTIONS_START
id=Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely identifies it everywhere (client and server side)
name='Object ' + options.id - Each Object has a name
name=this.constructor.name + '(' + options.id + ')' - Each Object has a name
dirty=false - When dirty is true, it means that this object is in transition from having a child Object to not having this child Object, and will probably end up in an uninitialized state. During the next few clock cycles this child Object will have its parent reference to this Object removed.
initialized=false - A boolean which indicates whether or not this Object has initialized
initializeDepth=0 - The amount of times this Object passed through initialize() functions

View File

@ -1,3 +1,9 @@
//GENERATED_IMPORTS_START
//GENERATED_IMPORTS_END
//CUSTOM_IMPORTS_START
//CUSTOM_IMPORTS_END
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');

View File

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

View File

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

View File

@ -40,6 +40,7 @@ GENERATED_SET_INITIALIZED_METHOD
GENERATED_SET_INITIALIZED_METHOD_AFTER
GENERATED_SET_RUNTIME_METHOD
GENERATED_SET_RUNTIME_METHOD_AFTER
GENERATED_SOURCE
GENERATED_START_METHOD
GENERATED_START_METHOD_AFTER
GENERATED_STATIC_ASYNC_METHOD

View File

@ -1,6 +1,46 @@
const {assert} = require('chai');
const Event = require('../src/r3/r3-event.js');
//GENERATED_COMPONENT_IMPORTS_START
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 ComponentGraphics = require('../src/r3/r3-component/./r3-component-graphics.js');
const ComponentImage = require('../src/r3/r3-component/./r3-component-image.js');
const ComponentMaterial = require('../src/r3/r3-component/./r3-component-material.js');
const ComponentMesh = require('../src/r3/r3-component/./r3-component-mesh.js');
const ComponentTexture = require('../src/r3/r3-component/./r3-component-texture.js');
const ComponentInput = require('../src/r3/r3-component/./r3-component-input.js');
const ComponentTouch = require('../src/r3/r3-component/./r3-component-touch.js');
//GENERATED_COMPONENT_IMPORTS_END
//GENERATED_ENTITY_IMPORTS_START
const EntitySlider = require('../src/r3/r3-entity/./r3-entity-slider.js');
//GENERATED_ENTITY_IMPORTS_END
//GENERATED_RUNTIME_IMPORTS_START
const RuntimeCoder = require('../src/r3/r3-runtime/./r3-runtime-coder.js');
const RuntimeCodeMirror = require('../src/r3/r3-runtime/./r3-runtime-code-mirror.js');
const RuntimeDOM = require('../src/r3/r3-runtime/./r3-runtime-d-o-m.js');
const RuntimeDocument = require('../src/r3/r3-runtime/./r3-runtime-document.js');
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 RuntimeNodeJSImage = require('../src/r3/r3-runtime/./r3-runtime-node-j-s-image.js');
const RuntimeWebImage = require('../src/r3/r3-runtime/./r3-runtime-web-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');
const RuntimeStatistics = require('../src/r3/r3-runtime/./r3-runtime-statistics.js');
const RuntimeStats = require('../src/r3/r3-runtime/./r3-runtime-stats.js');
//GENERATED_RUNTIME_IMPORTS_END
//GENERATED_R3_OBJECT_IMPORTS_START
const Project = require('../src/r3/r3-object/./r3-project.js');
//GENERATED_R3_OBJECT_IMPORTS_END
describe('R3 Tests', () => {
it (
@ -22,13 +62,66 @@ describe('R3 Tests', () => {
'Creation of all components succeed',
() => {
const Component = require('../src/r3/r3-component');
//GENERATED_COMPONENT_CREATE_START
const componentCode = new ComponentCode();
const componentDOM = new ComponentDOM();
const componentCanvas = new ComponentCanvas();
const componentGraphics = new ComponentGraphics();
const componentImage = new ComponentImage();
const componentMaterial = new ComponentMaterial();
const componentMesh = new ComponentMesh();
const componentTexture = new ComponentTexture();
const componentInput = new ComponentInput();
const componentTouch = new ComponentTouch();
//GENERATED_COMPONENT_CREATE_END
for (let Constructor in Component) {
if (Component.hasOwnProperty(Constructor) && typeof Component[Constructor] === 'function') {
let component = new Component[Constructor]();
}
}
}
);
it (
'Creation of all entities succeed',
() => {
//GENERATED_ENTITY_CREATE_START
const entitySlider = new EntitySlider();
//GENERATED_ENTITY_CREATE_END
}
);
it (
'Creation of all runtimes succeed',
() => {
//GENERATED_RUNTIME_CREATE_START
const runtimeCoder = new RuntimeCoder();
const runtimeCodeMirror = new RuntimeCodeMirror();
const runtimeDOM = new RuntimeDOM();
const runtimeDocument = new RuntimeDocument();
const runtimeGUI = new RuntimeGUI();
const runtimeControlKit = new RuntimeControlKit();
const runtimeGraphics = new RuntimeGraphics();
const runtimeThree = new RuntimeThree();
const runtimeImage = new RuntimeImage();
const runtimeNodeJSImage = new RuntimeNodeJSImage();
const runtimeWebImage = new RuntimeWebImage();
const runtimePhysics = new RuntimePhysics();
const runtimeBullet = new RuntimeBullet();
const runtimeSocket = new RuntimeSocket();
const runtimeStatistics = new RuntimeStatistics();
const runtimeStats = new RuntimeStats();
//GENERATED_RUNTIME_CREATE_END
}
);
it (
'Creation of all objects succeed',
() => {
//GENERATED_R3_OBJECT_CREATE_START
const project = new Project();
//GENERATED_R3_OBJECT_CREATE_END
}
);

View File

@ -21,6 +21,10 @@ function from_camel_case($input, $seperator = '_') {
return implode($seperator, $ret);
}
function to_upper_underscore($input, $seperator = '_') {
return strtoupper(from_camel_case($input, $seperator));
}
if (isset($argc)) {
for ($i = 0; $i < $argc; $i++) {
// echo "Argument #" . $i . " - " . $argv[$i] . "\n";

View File

@ -1 +1 @@
3.0.171
3.0.202