objects moved, server side starting

master
Theunis J. Botha 2021-10-01 06:08:34 +02:00
parent d2474293e3
commit 70b7dcf438
55 changed files with 2227 additions and 8723 deletions

View File

@ -11,7 +11,7 @@ r3 create ComponentTouch component_extends ComponentInput ./r3-component/
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 create Project object_extends R3Object ./r3-object/
r3 create R3 r3_base ./
r3 create RuntimeBullet runtime_extends RuntimePhysics ./r3-runtime/
r3 create RuntimeCodeMirror runtime_extends RuntimeCoder ./r3-runtime/
@ -40,4 +40,4 @@ r3 create RuntimeWebImage runtime_extends RuntimeImage ./r3-runtime/
r3 create RuntimeNodeJSImage runtime_extends RuntimeImage ./r3-runtime/
r3 create Runtime base ./r3-runtime/
r3 create ComponentCode component_extends Component ./r3-component/
r3 create R3Object object_base ./
r3 create R3Object object_base ./r3-object/

10
dist/index.html vendored
View File

@ -39,11 +39,13 @@
slider.canvas = canvas;
slider.images = [image];
slider.canvas = null;
slider.canvas = canvas;
slider.images = [];
slider.images = [image];
// slider.canvas = null;
// slider.canvas = canvas;
// slider.images = [];
// slider.images = [image];
touch.canvas = canvas;
slider.touch = touch;
touch.canvas = null;
});
</script>
</body>

3640
dist/r3.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,232 +0,0 @@
const {series, parallel, src, dest, watch} = require('gulp');
const clean = require('gulp-clean');
const stringReplace = require('gulp-string-replace');
const webpack_stream = require('webpack-stream');
const webpack_config = require('./webpack.config.js');
const map = require('map-stream');
const execSync = require('child_process').execSync;
// gulp.task('buildEvents', buildEvents);
console.log('current working dir : ' + process.cwd());
const paths = {
source : './src/r3/**/*.js',
testSource : './test/*.js',
web : './dist',
node : './dist/r3-node'
};
function replace() {
return stringReplace('__DATE__', new Date().toString());
}
let update = false;
function clearBuild() {
return src(
paths.node,
{
allowEmpty: true
}
).pipe(clean());
}
function build() {
return src(paths.source)
.pipe(webpack_stream( webpack_config ))
.pipe(replace())
.pipe(dest(paths.web));
}
function buildNode() {
return src(paths.source)
.pipe(replace())
.pipe(dest(paths.node));
}
//
// function logMatches(regex) {
// return map(function(file, done) {
//
// //console.log(file);
//
// let contents = file.contents.toString();
//
// let m;
//
// do {
// m = regex.exec(contents);
// if (m) {
// console.log(m[0]);
// }
// } while (m);
// let matches = [...contents.matchAll(regex)];
// if (matches) {
// matches.map(
// function(match) {
// console.log(match[0]);
// }
// )
// }
// file.contents.toString().match(regex).forEach(function(match) {
// console.log(file.path + ': ' + match);
// });
// done(null, file);
// });
// }
// function buildEvents() {
//
// return gulp.src(
// [
// paths.source,
// paths.testSource
// ]
// ).pipe(logMatches(/Event\.([A-Z]+_*){2,}/g));
// $files = scandir('.', SCANDIR_SORT_DESCENDING);
//
// $events = [];
//
// foreach ($files as $file) {
//
//
// if (
// preg_match('/\.js$/', $file) &&
// !preg_match('/r3\-a\-2\-event/', $file)
// ) {
// echo "processing file " . $file . "\n";
//
// $fn = fopen($file, "r");
//
// while (!feof($fn)) {
// $line = fgets($fn);
//
//
// if (
// preg_match('/R3.Event\./', $line) &&
// !preg_match('/Emit|Subscribe|.call|GetEventName|Async|prototype/', $line)
// ) {
// $matches = [];
// preg_match_all('/(R3.Event\..*?)(\s+|,|;|$|\))/', $line, $matches);
//
// if ($matches[1] && $matches[1][0]) {
//
// $event = $matches[1][0];
//
// if (in_array($event, $events)) {
// // Do nothing
// } else {
// array_push($events, $event);
// }
//
// }
//
//
// }
//
//
// }
//
// fclose($fn);
// }
//
//
// }
//
// array_push($events, 'R3.Event.START');
// array_push($events, 'R3.Event.PAUSE');
// array_push($events, 'R3.Event.RESTART');
//
// sort($events);
//
// $i = 1;
//
// $eventList = '';
//
// $eventFunction = "/**\n * R3.Event.GetEventName\n * @param eventId\n * @returns {string}\n * @constructor\n */\nR3.Event.GetEventName = function(eventId) {\n\n\tswitch(eventId) {\n";
//
// foreach ($events as $event) {
// $eventList .= $event . " = " . "0x" . dechex($i) . ";\n";
//
// $eventFunction .= "\t\tcase 0x" . dechex($i). " : return '" . strtolower(str_replace('R3.Event.', '', $event)) . "';\n";
//
// $i++;
// }
//
// $eventList .= "R3.Event.MAX_EVENTS = " . "0x" . dechex($i) . ";\n\n";
//
// $eventFunction .= "\t\tdefault :\n\t\t\tthrow new Error('Event type not defined : ' + eventId);\n";
// $eventFunction .= "\t}\n\n";
// $eventFunction .= "};\n";
//
// echo $eventList;
// echo $eventFunction;
//
// file_put_contents('r3-a-2-event-1.js', $eventList . $eventFunction);
//
// }
const updateFile = function(path) {
return function(cb) {
if (!update) {
console.error('updating ' + path);
update=true
execSync('./update_options.php ' + path)
} else {
update = false;
console.error('not updating ' + path);
}
cb();
}
}
function monitor() {
const watcher = watch(
[paths.source],
series([
clearBuild,
parallel(build, buildNode)
])
);
watcher.on(
'add',
function (path, stats) {
series([
clearBuild,
parallel(build, buildNode)
])();
}
);
watcher.on(
'unlink',
function (path, stats) {
series([
clearBuild,
parallel(build, buildNode)
])();
}
);
watcher.on(
'change',
function (path, stats) {
series([
clearBuild,
parallel(build, buildNode)
])();
}
);
}
exports.build = series([clearBuild, parallel(build, buildNode)]);
exports.default = series([clearBuild, parallel(build, buildNode), monitor]);

6024
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,18 @@
{
"name": "r3",
"version" : "3.0.104",
"version": "3.0.140",
"description": "",
"private": true,
"dependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.5",
"@feathersjs/express": "^4.5.3",
"@feathersjs/feathers": "^4.5.3",
"@feathersjs/socketio": "^4.5.3",
"babel-loader": "^8.2.2",
"chai": "^4.3.4",
"gulp": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-concat": "^2.6.1",
"gulp-sort": "^2.0.0",
"gulp-string-replace": "^1.1.2",
"map-stream": "0.0.7",
"mocha": "^9.0.0",
"webpack": "^5.39.1",
"webpack-cli": "*",
"webpack-stream": "^6.1.2"
"mocha": "^9.0.0"
},
"scripts": {
"test": "mocha --recursive",
"test-debug": "mocha --inspect-brk --recursive",
"test": "mocha --inspect=0.0.0.0:9229 --recursive",
"test-brk": "mocha --inspect-brk=0.0.0.0:9229 --recursive",
"build": "webpack --webpack-config.js",
"watch": "webpack --webpack-config.js --watch",
"start": "gulp"

55
r3.php
View File

@ -1,6 +1,15 @@
#!/usr/bin/php
<?php
echo '';
echo ' _____ __ ';echo "\n";
echo ' _____|__ / ____ / /_ ____ ';echo "\n";
echo ' / ___/ /_ < / __ \/ __ \/ __ \ ';echo "\n";
echo ' / / ___/ /_ / /_/ / / / / /_/ /';echo "\n";
echo '/_/ /____/(_) .___/_/ /_/ .___/ ';echo "\n";
echo ' /_/ /_/ ';echo "\n";
echo "\n";
include "vendor/autoload.php";
$dotenv = Dotenv\Dotenv::createImmutable($_SERVER['PWD']);
@ -1314,24 +1323,6 @@ function generateMethods($file, $tokens, $token, $section)
}
function buildIndexBody($graph, $node, &$body, $nameSpace)
{
if (sizeof($node->children) != 0) {
$originalNameSpace = $nameSpace;
foreach ($node->children as $child) {
$nameSpace = $originalNameSpace . '.' . $child->nameSpaceClassName;
array_push($body, $nameSpace . ' = ' . $child->name . ';');
buildIndexBody($graph, $child, $body, $nameSpace);
$child->nameSpace = $originalNameSpace;
}
}
}
function buildImportsAndBody(&$imports, &$body, $node, $type, $nameSpace)
{
@ -1341,7 +1332,8 @@ function buildImportsAndBody(&$imports, &$body, $node, $type, $nameSpace)
$nameSpace = $originalNameSpace . '.' . $child->nameSpaceClassName;
$file = str_replace('src/r3/r3-' . strtolower($type), '.', $child->file);
$file = str_replace('src/r3/r3-' . str_replace('r3-', '', strtolower(from_camel_case($type,'-'))), '.', $child->file);
$file = preg_replace('/src\/r3/','..',$file);
array_push($imports, "const " . $child->name . ' = require(\'' . $file . "');");
array_push($body, "$nameSpace = " . $child->name . ';');
@ -1366,14 +1358,13 @@ function generateIndex($types)
$body = [];
$exports = [];
$nodes = $graph->walk();
foreach ($nodes as $node) {
if (preg_match("/\b$type\b/", $node->name)) {
$file = str_replace('src/r3/r3-' . strtolower($type), '.', $node->file);
$file = str_replace('src/r3/r3-' . str_replace('r3-', '', strtolower(from_camel_case($type,'-'))), '.', $node->file);
array_push($imports, "const " . $node->name . ' = require(\'' . $file . "');");
@ -1384,7 +1375,7 @@ function generateIndex($types)
array_push($exports, "module.exports = $type;");
$indexFile = 'src/r3/r3-'. strtolower($type) . '/index.js';
$indexFile = 'src/r3/r3-'. str_replace('r3-', '', strtolower(from_camel_case($type,'-'))) . '/index.js';
file_put_contents($indexFile, $template);
@ -1402,6 +1393,7 @@ function generateR3($nodes, $graph)
$modifiedPaths = [
'/\br3-component.js$/',
'/\br3-entity.js$/',
'/\br3-object.js$/',
'/\br3-runtime.js$/',
'/\br3-system.js$/'
];
@ -1464,11 +1456,11 @@ function generateR3($nodes, $graph)
$template = file_get_contents('src/templates/index.template');
file_put_contents($indexFile, $template);
$imports = ['const R3 = require(\'r3-r3.js\');'];
$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);");
array_push($indexBody, "console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);");
foreach ($nodes as $node) {
/**
@ -1623,10 +1615,11 @@ function generateR3Dist($nodes)
writeSource($r3, $r3js);
$indexFiles = [
'src/r3/r3-system/index.js',
'src/r3/r3-component/index.js',
'src/r3/r3-runtime/index.js',
'src/r3/r3-entity/index.js',
'src/r3/r3-object/index.js',
'src/r3/r3-runtime/index.js',
'src/r3/r3-system/index.js',
];
foreach ($indexFiles as $indexFile) {
@ -2094,10 +2087,11 @@ if ($argv[2] == 'build-dist') {
generateIndex(
[
'System',
'Component',
'Entity',
'R3Object',
'Runtime',
'Entity'
'System',
]
);
@ -2110,10 +2104,11 @@ if ($argv[2] == 'build-dist') {
generateOutOfClassImplementationDefines(
$graph,
[
'System',
'Component',
'Entity',
'R3Object',
'Runtime',
'Entity'
'System',
]
);

View File

@ -1,9 +1,9 @@
//GENERATED_IMPORTS_START
const R3 = require('r3-r3.js');
const R3 = require('./r3-r3.js');
//GENERATED_IMPORTS_END
//GENERATED_INDEX_BODY_START
console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);
console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate);
R3.System.DOM.Start();
R3.System.Input.Start();
R3.System.Linking.Start();

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const ComponentDOM = require('.././r3-component-d-o-m.js');
const ComponentDOM = require('./r3-component-d-o-m.js');
/**
@ -122,9 +122,7 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -151,8 +149,6 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -197,29 +193,17 @@ class ComponentCanvas extends ComponentDOM {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* type - No comment
@ -286,12 +270,15 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
if (this.initialized) {
Event.Emit(Event.CANVAS_COMPONENT_INITIALIZED, this);
}
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const Component = require('.././r3-component.js');
const Component = require('./r3-component.js');
/**
@ -100,9 +100,7 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -125,8 +123,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -170,29 +166,17 @@ class ComponentCode extends Component {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -240,7 +224,7 @@ class ComponentCode extends Component {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const Component = require('.././r3-component.js');
const Component = require('./r3-component.js');
/**
@ -101,9 +101,7 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -127,8 +125,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -172,29 +168,17 @@ class ComponentDOM extends Component {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -243,13 +227,15 @@ class ComponentDOM extends Component {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this);
if (this.initialized) {
Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this);
}
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const Component = require('.././r3-component.js');
const Component = require('./r3-component.js');
/**
@ -100,9 +100,7 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -125,8 +123,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -170,29 +166,17 @@ class ComponentGraphics extends Component {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -235,13 +219,15 @@ class ComponentGraphics extends Component {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
if (this.initialized) {
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
}
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const ComponentGraphics = require('.././r3-component-graphics.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -134,9 +134,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -170,8 +168,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -219,29 +215,17 @@ class ComponentImage extends ComponentGraphics {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* src - The src attribute of this image, defaults to a 15% opaque 1x1 green pixel
@ -376,13 +360,15 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
if (this.initialized) {
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
}
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const Component = require('.././r3-component.js');
const Component = require('./r3-component.js');
/**
@ -100,9 +100,7 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -125,8 +123,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -170,29 +166,17 @@ class ComponentInput extends Component {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -235,13 +219,15 @@ class ComponentInput extends Component {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this);
if (this.initialized) {
Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this);
}
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const ComponentGraphics = require('.././r3-component-graphics.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -118,9 +118,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -143,8 +141,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -188,29 +184,17 @@ class ComponentMaterial extends ComponentGraphics {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -258,7 +242,7 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const ComponentGraphics = require('.././r3-component-graphics.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -118,9 +118,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -143,8 +141,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -188,29 +184,17 @@ class ComponentMesh extends ComponentGraphics {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -258,7 +242,7 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const ComponentGraphics = require('.././r3-component-graphics.js');
const ComponentGraphics = require('./r3-component-graphics.js');
/**
@ -118,9 +118,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -143,8 +141,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -188,29 +184,17 @@ class ComponentTexture extends ComponentGraphics {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -258,7 +242,7 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const ComponentInput = require('.././r3-component-input.js');
const ComponentInput = require('./r3-component-input.js');
/**
@ -118,9 +118,7 @@ const ComponentInput = require('.././r3-component-input.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -145,8 +143,6 @@ const ComponentInput = require('.././r3-component-input.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -190,29 +186,17 @@ class ComponentTouch extends ComponentInput {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
*/
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* canvas - A Touch Component requires a Canvas component to bind to.
@ -236,18 +220,18 @@ class ComponentTouch extends ComponentInput {
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
Event.OBJECT_PROPERTY_UPDATE,
{
entity : this,
object : this,
property : 'canvas',
value : x
}
);
this.canvasBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
Event.OBJECT_PROPERTY_UPDATED,
{
entity : this,
object : this,
property : 'canvas',
value : x
}
@ -297,13 +281,15 @@ class ComponentTouch extends ComponentInput {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.TOUCH_COMPONENT_INITIALIZED, this);
if (this.initialized) {
Event.Emit(Event.TOUCH_COMPONENT_INITIALIZED, this);
}
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const R3Object = require('.././r3-r3-object.js');
const R3Object = require('../r3-object/r3-object.js');
/**
@ -117,8 +117,6 @@ class Component extends R3Object {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
super(options);
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
@ -131,6 +129,8 @@ class Component extends R3Object {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const Entity = require('.././r3-entity.js');
const Entity = require('./r3-entity.js');
/**
@ -107,11 +107,9 @@ const Entity = require('.././r3-entity.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this Entity has initialized
initializeDepth=0 - The amount of times this Entity passed through initialize() functions
parent=null - The parent R3.Object of this component
components=[] - A list of components that this entity is composed of
started=false - Indicates whether or not this entity is active (subscribing to events) or not
subscriptions={} - An association object which hold the subscription handles for Events this system is listening to. The system can stop receiving events by calling remove() on a handle.
dirty=false - When dirty is true, it means that this entity is in transition from having a Component to not having this Component, and will probably end up in an uninitialized state. During the next few clock cycles this child Component will have its parent reference to this entity removed.
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -194,12 +192,6 @@ class EntitySlider extends Entity {
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
/**
* parent - The parent R3.Object of this component
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
}
/**
* components - A list of components that this entity is composed of
*/
@ -219,14 +211,6 @@ class EntitySlider extends Entity {
if (typeof options.subscriptions === 'undefined') {
options.subscriptions = {};
}
/**
* dirty - When dirty is true, it means that this entity is in transition from having a Component to not
* having this Component, and will probably end up in an uninitialized state. During the next few
* clock cycles this child Component will have its parent reference to this entity removed.
*/
if (typeof options.dirty === 'undefined') {
options.dirty = false;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
@ -266,18 +250,18 @@ class EntitySlider extends Entity {
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
Event.OBJECT_PROPERTY_UPDATE,
{
entity : this,
object : this,
property : 'images',
value : x
}
);
this.imagesBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
Event.OBJECT_PROPERTY_UPDATED,
{
entity : this,
object : this,
property : 'images',
value : x
}
@ -301,18 +285,18 @@ class EntitySlider extends Entity {
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
Event.OBJECT_PROPERTY_UPDATE,
{
entity : this,
object : this,
property : 'canvas',
value : x
}
);
this.canvasBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
Event.OBJECT_PROPERTY_UPDATED,
{
entity : this,
object : this,
property : 'canvas',
value : x
}
@ -336,18 +320,18 @@ class EntitySlider extends Entity {
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
Event.OBJECT_PROPERTY_UPDATE,
{
entity : this,
object : this,
property : 'touch',
value : x
}
);
this.touchBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
Event.OBJECT_PROPERTY_UPDATED,
{
entity : this,
object : this,
property : 'touch',
value : x
}
@ -405,7 +389,7 @@ class EntitySlider extends Entity {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const R3Object = require('.././r3-r3-object.js');
const R3Object = require('../r3-object/r3-object.js');
/**

View File

@ -347,99 +347,101 @@ class Event {
//GENERATED_EVENTS_START
Event.BEFORE_RENDER = 0x1;
Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST = 0x2;
Event.COMPONENT_CREATED = 0x3;
Event.COMPONENT_INITIALIZED = 0x4;
Event.CREATE_INSTANCE_BEFORE = 0x5;
Event.DISPOSE_INSTANCE = 0x6;
Event.DISPOSE_OBJECT = 0x7;
Event.DOM_COMPONENT_INITIALIZED = 0x8;
Event.ENTITY_CREATED = 0x9;
Event.ENTITY_INITIALIZED = 0xa;
Event.ENTITY_PROPERTY_UPDATE = 0xb;
Event.ENTITY_PROPERTY_UPDATED = 0xc;
Event.ENTITY_STARTED = 0xd;
Event.GET_API_URL = 0xe;
Event.GET_RUNTIME = 0xf;
Event.GET_WINDOW_SIZE = 0x10;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0x11;
Event.IMAGE_COMPONENT_INITIALIZED = 0x12;
Event.IMAGE_INSTANCE_CREATED = 0x13;
Event.INPUT_COMPONENT_INITIALIZED = 0x14;
Event.INSTANCE_CREATED = 0x15;
Event.INSTANCE_DISPOSED = 0x16;
Event.KEYBOARD_DOWN = 0x17;
Event.KEYBOARD_UP = 0x18;
Event.MOUSE_DOWN = 0x19;
Event.MOUSE_MOVE = 0x1a;
Event.MOUSE_UP = 0x1b;
Event.MOUSE_WHEEL = 0x1c;
Event.OBJECT_CREATED = 0x1d;
Event.PAUSE = 0x1e;
Event.PROJECT_INITIALIZED = 0x1f;
Event.RESTART = 0x20;
Event.SLIDER_ENTITY_INITIALIZED = 0x21;
Event.START = 0x22;
Event.TOUCH_CANCEL = 0x23;
Event.TOUCH_COMPONENT_INITIALIZED = 0x24;
Event.TOUCH_END = 0x25;
Event.TOUCH_MOVE = 0x26;
Event.TOUCH_START = 0x27;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x28;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x29;
Event.UPDATE_INSTANCE_AFTER = 0x2a;
Event.UPDATE_INSTANCE_BEFORE = 0x2b;
Event.UPDATE_INSTANCE_PROPERTY = 0x2c;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2d;
Event.MAX_EVENTS = 0x2e;
Event.CANVAS_COMPONENT_INITIALIZED = 0x3;
Event.COMPONENT_CREATED = 0x4;
Event.COMPONENT_INITIALIZED = 0x5;
Event.CREATE_INSTANCE_BEFORE = 0x6;
Event.DISPOSE_INSTANCE = 0x7;
Event.DISPOSE_OBJECT = 0x8;
Event.DOM_COMPONENT_INITIALIZED = 0x9;
Event.ENTITY_CREATED = 0xa;
Event.ENTITY_INITIALIZED = 0xb;
Event.ENTITY_STARTED = 0xc;
Event.GET_API_URL = 0xd;
Event.GET_RUNTIME = 0xe;
Event.GET_WINDOW_SIZE = 0xf;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0x10;
Event.IMAGE_COMPONENT_INITIALIZED = 0x11;
Event.IMAGE_INSTANCE_CREATED = 0x12;
Event.INPUT_COMPONENT_INITIALIZED = 0x13;
Event.INSTANCE_CREATED = 0x14;
Event.INSTANCE_DISPOSED = 0x15;
Event.KEYBOARD_DOWN = 0x16;
Event.KEYBOARD_UP = 0x17;
Event.MOUSE_DOWN = 0x18;
Event.MOUSE_MOVE = 0x19;
Event.MOUSE_UP = 0x1a;
Event.MOUSE_WHEEL = 0x1b;
Event.OBJECT_CREATED = 0x1c;
Event.OBJECT_PROPERTY_UPDATE = 0x1d;
Event.OBJECT_PROPERTY_UPDATED = 0x1e;
Event.PAUSE = 0x1f;
Event.PROJECT_INITIALIZED = 0x20;
Event.RESTART = 0x21;
Event.SLIDER_ENTITY_INITIALIZED = 0x22;
Event.START = 0x23;
Event.TOUCH_CANCEL = 0x24;
Event.TOUCH_COMPONENT_INITIALIZED = 0x25;
Event.TOUCH_END = 0x26;
Event.TOUCH_MOVE = 0x27;
Event.TOUCH_START = 0x28;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x29;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2a;
Event.UPDATE_INSTANCE_AFTER = 0x2b;
Event.UPDATE_INSTANCE_BEFORE = 0x2c;
Event.UPDATE_INSTANCE_PROPERTY = 0x2d;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2e;
Event.MAX_EVENTS = 0x2f;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'before_render';
case 0x2 : return 'blacklisted_component_instance_request';
case 0x3 : return 'component_created';
case 0x4 : return 'component_initialized';
case 0x5 : return 'create_instance_before';
case 0x6 : return 'dispose_instance';
case 0x7 : return 'dispose_object';
case 0x8 : return 'dom_component_initialized';
case 0x9 : return 'entity_created';
case 0xa : return 'entity_initialized';
case 0xb : return 'entity_property_update';
case 0xc : return 'entity_property_updated';
case 0xd : return 'entity_started';
case 0xe : return 'get_api_url';
case 0xf : return 'get_runtime';
case 0x10 : return 'get_window_size';
case 0x11 : return 'graphics_component_initialized';
case 0x12 : return 'image_component_initialized';
case 0x13 : return 'image_instance_created';
case 0x14 : return 'input_component_initialized';
case 0x15 : return 'instance_created';
case 0x16 : return 'instance_disposed';
case 0x17 : return 'keyboard_down';
case 0x18 : return 'keyboard_up';
case 0x19 : return 'mouse_down';
case 0x1a : return 'mouse_move';
case 0x1b : return 'mouse_up';
case 0x1c : return 'mouse_wheel';
case 0x1d : return 'object_created';
case 0x1e : return 'pause';
case 0x1f : return 'project_initialized';
case 0x20 : return 'restart';
case 0x21 : return 'slider_entity_initialized';
case 0x22 : return 'start';
case 0x23 : return 'touch_cancel';
case 0x24 : return 'touch_component_initialized';
case 0x25 : return 'touch_end';
case 0x26 : return 'touch_move';
case 0x27 : return 'touch_start';
case 0x28 : return 'update_from_instance_after';
case 0x29 : return 'update_from_instance_before';
case 0x2a : return 'update_instance_after';
case 0x2b : return 'update_instance_before';
case 0x2c : return 'update_instance_property';
case 0x2d : return 'update_property_from_instance';
case 0x3 : return 'canvas_component_initialized';
case 0x4 : return 'component_created';
case 0x5 : return 'component_initialized';
case 0x6 : return 'create_instance_before';
case 0x7 : return 'dispose_instance';
case 0x8 : return 'dispose_object';
case 0x9 : return 'dom_component_initialized';
case 0xa : return 'entity_created';
case 0xb : return 'entity_initialized';
case 0xc : return 'entity_started';
case 0xd : return 'get_api_url';
case 0xe : return 'get_runtime';
case 0xf : return 'get_window_size';
case 0x10 : return 'graphics_component_initialized';
case 0x11 : return 'image_component_initialized';
case 0x12 : return 'image_instance_created';
case 0x13 : return 'input_component_initialized';
case 0x14 : return 'instance_created';
case 0x15 : return 'instance_disposed';
case 0x16 : return 'keyboard_down';
case 0x17 : return 'keyboard_up';
case 0x18 : return 'mouse_down';
case 0x19 : return 'mouse_move';
case 0x1a : return 'mouse_up';
case 0x1b : return 'mouse_wheel';
case 0x1c : return 'object_created';
case 0x1d : return 'object_property_update';
case 0x1e : return 'object_property_updated';
case 0x1f : return 'pause';
case 0x20 : return 'project_initialized';
case 0x21 : return 'restart';
case 0x22 : return 'slider_entity_initialized';
case 0x23 : return 'start';
case 0x24 : return 'touch_cancel';
case 0x25 : return 'touch_component_initialized';
case 0x26 : return 'touch_end';
case 0x27 : return 'touch_move';
case 0x28 : return 'touch_start';
case 0x29 : return 'update_from_instance_after';
case 0x2a : return 'update_from_instance_before';
case 0x2b : return 'update_instance_after';
case 0x2c : return 'update_instance_before';
case 0x2d : return 'update_instance_property';
case 0x2e : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}

38
src/r3/r3-object/index.js Normal file
View File

@ -0,0 +1,38 @@
//GENERATED_IMPORTS_START
const R3Object = require('./r3-object.js');
const Project = require('./r3-project.js');
const Entity = require('../r3-entity/r3-entity.js');
const EntitySlider = require('../r3-entity/r3-entity-slider.js');
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 ComponentGraphics = require('../r3-component/r3-component-graphics.js');
const ComponentImage = require('../r3-component/r3-component-image.js');
const ComponentMaterial = require('../r3-component/r3-component-material.js');
const ComponentMesh = require('../r3-component/r3-component-mesh.js');
const ComponentTexture = require('../r3-component/r3-component-texture.js');
const ComponentInput = require('../r3-component/r3-component-input.js');
const ComponentTouch = require('../r3-component/r3-component-touch.js');
//GENERATED_IMPORTS_END
//GENERATED_INDEX_BODY_START
R3Object.Project = Project;
R3Object.Entity = Entity;
R3Object.Entity.Slider = EntitySlider;
R3Object.Component = Component;
R3Object.Component.Code = ComponentCode;
R3Object.Component.DOM = ComponentDOM;
R3Object.Component.DOM.Canvas = ComponentCanvas;
R3Object.Component.Graphics = ComponentGraphics;
R3Object.Component.Graphics.Image = ComponentImage;
R3Object.Component.Graphics.Material = ComponentMaterial;
R3Object.Component.Graphics.Mesh = ComponentMesh;
R3Object.Component.Graphics.Texture = ComponentTexture;
R3Object.Component.Input = ComponentInput;
R3Object.Component.Input.Touch = ComponentTouch;
//GENERATED_INDEX_BODY_END
//GENERATED_EXPORTS_START
module.exports = R3Object;
//GENERATED_EXPORTS_END

View File

@ -1,5 +1,5 @@
const Event = require('./r3-event');
const Utils = require('./r3-utils');
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
/**
@ -65,9 +65,10 @@ 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
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
parent=null - All Objects could have a parent
parents=[] - All Objects could have parent(s)
children=[] - All Objects could have some children
required={} - All Objects could have some required Objects which need to initialize before this Object can initialize
TEMPLATE_OPTIONS_END
@ -102,8 +103,6 @@ class R3Object extends Event {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
super(options);
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
@ -116,6 +115,8 @@ class R3Object extends Event {
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* id - Each Object receives an 15 digit random ID which uniquely identifies it everywhere (client and
@ -130,6 +131,14 @@ class R3Object extends Event {
if (typeof options.name === 'undefined') {
options.name = 'Object ' + options.id;
}
/**
* dirty - 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.
*/
if (typeof options.dirty === 'undefined') {
options.dirty = false;
}
/**
* initialized - A boolean which indicates whether or not this Object has initialized
*/
@ -143,10 +152,10 @@ class R3Object extends Event {
options.initializeDepth = 0;
}
/**
* parent - All Objects could have a parent
* parents - All Objects could have parent(s)
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.parents === 'undefined') {
options.parents = [];
}
/**
* children - All Objects could have some children
@ -199,7 +208,6 @@ class R3Object extends Event {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
this.setInitialized();
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
@ -288,19 +296,17 @@ class R3Object extends Event {
}
}.bind(this);
this.initialized = true;
for (let requiredProperty in this.required) {
if (this.required.hasOwnProperty(requiredProperty)) {
if (requiredProperty === property) {
if (isReady(property, value)) {
this.initialized = true;
} else {
if (!isReady(property, value)) {
this.initialized = false;
return;
}
} else {
if (isReady(requiredProperty, this[requiredProperty])) {
this.initialized = true;
} else {
if (!isReady(requiredProperty, this[requiredProperty])) {
this.initialized = false;
return;
}
@ -339,6 +345,21 @@ class R3Object extends Event {
//GENERATED_STATIC_OPTIONS_INIT_END
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
R3Object.PROJECT = 0x0;
R3Object.ENTITY = 0x1;
R3Object.ENTITY_SLIDER = 0x2;
R3Object.COMPONENT = 0x3;
R3Object.COMPONENT_CODE = 0x4;
R3Object.COMPONENT_DOM = 0x5;
R3Object.COMPONENT_CANVAS = 0x6;
R3Object.COMPONENT_GRAPHICS = 0x7;
R3Object.COMPONENT_IMAGE = 0x8;
R3Object.COMPONENT_MATERIAL = 0x9;
R3Object.COMPONENT_MESH = 0xa;
R3Object.COMPONENT_TEXTURE = 0xb;
R3Object.COMPONENT_INPUT = 0xc;
R3Object.COMPONENT_TOUCH = 0xd;
R3Object.MAX_R3OBJECT = 0xe;
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -1,6 +1,6 @@
const Event = require('./r3-event');
const Utils = require('./r3-utils');
const R3Object = require('./r3-r3-object.js');
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const R3Object = require('./r3-object.js');
/**
@ -217,7 +217,7 @@ class Project extends R3Object {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -1,35 +1,35 @@
class R3 {
static version = '3.0.104';
static compileDate = '2021 Sep 24 - 09:31:24 am';
static Version = '3.0.140';
static CompileDate = '2021 Oct 01 - 06:06:01 am';
}
//GENERATED_IMPORTS_START
const Runtime = require('./r3-runtime/');
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-r3-object.js');
const R3Object = require('./r3-object/');
const Project = require('./r3-object/r3-project.js');
const Entity = require('./r3-entity/');
const Component = require('./r3-component/');
const Project = require('./r3-project.js');
//GENERATED_IMPORTS_END
//GENERATED_DEFINES_START
R3.Runtime = Runtime;
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.Project = Project;
R3.Code = Component.Code;
R3.Canvas = Component.DOM.Canvas;
R3.Image = Component.Graphics.Image;
R3.Material = Component.Graphics.Material;
R3.Mesh = Component.Graphics.Mesh;
R3.Texture = Component.Graphics.Texture;
R3.Touch = Component.Input.Touch;
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

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**
@ -70,8 +70,8 @@ const System = require('.././r3-system.js');
Event.ENTITY_INITIALIZED
Event.INSTANCE_CREATED
Event.CREATE_INSTANCE_BEFORE - @returns boolean delayInstance which indicates whether or not instance creation is delayed (handled) by another system. (i.e. where instance creation order is of importance)
Event.ENTITY_PROPERTY_UPDATE
Event.ENTITY_PROPERTY_UPDATED
Event.OBJECT_PROPERTY_UPDATE
Event.OBJECT_PROPERTY_UPDATED
CUSTOM_STATIC_EVENT_LISTENERS_END
TEMPLATE_METHODS_START
@ -160,14 +160,14 @@ class SystemLinking extends System {
SystemLinking.OnCreateInstanceBefore
);
SystemLinking.Subscriptions['ENTITY_PROPERTY_UPDATE'] = Event.Subscribe(
Event.ENTITY_PROPERTY_UPDATE,
SystemLinking.OnEntityPropertyUpdate
SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATE'] = Event.Subscribe(
Event.OBJECT_PROPERTY_UPDATE,
SystemLinking.OnObjectPropertyUpdate
);
SystemLinking.Subscriptions['ENTITY_PROPERTY_UPDATED'] = Event.Subscribe(
Event.ENTITY_PROPERTY_UPDATED,
SystemLinking.OnEntityPropertyUpdated
SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATED'] = Event.Subscribe(
Event.OBJECT_PROPERTY_UPDATED,
SystemLinking.OnObjectPropertyUpdated
);
//GENERATED_STATIC_EVENT_LISTENERS_START_END
@ -211,11 +211,11 @@ class SystemLinking extends System {
SystemLinking.Subscriptions['CREATE_INSTANCE_BEFORE'].remove();
delete SystemLinking.Subscriptions['CREATE_INSTANCE_BEFORE'];
SystemLinking.Subscriptions['ENTITY_PROPERTY_UPDATE'].remove();
delete SystemLinking.Subscriptions['ENTITY_PROPERTY_UPDATE'];
SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATE'].remove();
delete SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATE'];
SystemLinking.Subscriptions['ENTITY_PROPERTY_UPDATED'].remove();
delete SystemLinking.Subscriptions['ENTITY_PROPERTY_UPDATED'];
SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATED'].remove();
delete SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATED'];
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
@ -355,96 +355,108 @@ class SystemLinking extends System {
}
/**
* OnEntityPropertyUpdate()
* - Listens to events of type Event.ENTITY_PROPERTY_UPDATE and executes this function.
* OnObjectPropertyUpdate()
* - Listens to events of type Event.OBJECT_PROPERTY_UPDATE and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return
*/
static OnEntityPropertyUpdate(object) {
static OnObjectPropertyUpdate(object) {
//GENERATED_STATIC_ON_ENTITY_PROPERTY_UPDATE_METHOD_START
//GENERATED_STATIC_ON_ENTITY_PROPERTY_UPDATE_METHOD_END
//GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_START
//GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_END
//CUSTOM_STATIC_ON_ENTITY_PROPERTY_UPDATE_METHOD_START
console.log('Entity object update of property ' + object.property);
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_START
let {value, property} = object;
// object = object.object;
console.log('object property update of ' + property);
/**
* Set the parent relationships
*/
if (object.value instanceof Array) {
if (value instanceof Array) {
/**
* This entity could have its property set to an empty array.
* This object could have its property set to an empty array.
* In this case - we should check its existing components and have their relationships
* severed
*/
if (object.value.length === 0) {
if (value.length === 0) {
if (object.entity[object.property] instanceof Array) {
for (let i = 0; i < object.entity[object.property].length; i++) {
if (object.entity[object.property][i] instanceof R3.Component) {
object.entity.dirty = true;
object.entity[object.property][i].parent = null;
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);
}
}
}
} else {
for (let i = 0; i < object.value.length; i++) {
if (object.value[i] instanceof R3.Component) {
object.value[i].parent = object.entity;
/**
* This
*/
for (let i = 0; i < value.length; i++) {
if (value[i] instanceof R3.Object) {
Utils.PushUnique(value[i].parents, object);
}
}
}
}
if (object.value instanceof R3.Component) {
object.value.parent = object.entity;
if (value instanceof R3.Object) {
Utils.PushUnique(value.parents, object);
}
/**
* The value was unassigned - remove the parent relationships of the existing
* components (if available)
*/
if (object.value === null || typeof object.value === 'undefined') {
if (object.entity[object.property] instanceof R3.Component) {
object.entity.dirty = true;
object.entity[object.property].parent = null;
if (value === null || typeof value === 'undefined') {
if (object[property] instanceof R3.Object) {
object.dirty = true;
Utils.RemoveFromArray(object[property].parents, object);
}
}
if (!object.entity.underConstruction) {
if (!object.underConstruction) {
if (object.entity.initialized) {
if (object.initialized) {
/**
* Check if this object will still be initialized after this assignment completes
*/
object.entity.setInitialized(object.property, object.value);
if (!object.entity.initialized) {
object.entity.initialized = true;
object.entity.stop();
object.setInitialized(property, value);
if (!object.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();
}
}
}
//CUSTOM_STATIC_ON_ENTITY_PROPERTY_UPDATE_METHOD_END
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_END
}
/**
* OnEntityPropertyUpdated()
* - Listens to events of type Event.ENTITY_PROPERTY_UPDATED and executes this function.
* OnObjectPropertyUpdated()
* - Listens to events of type Event.OBJECT_PROPERTY_UPDATED and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return
*/
static OnEntityPropertyUpdated(object) {
static OnObjectPropertyUpdated(object) {
//GENERATED_STATIC_ON_ENTITY_PROPERTY_UPDATED_METHOD_START
//GENERATED_STATIC_ON_ENTITY_PROPERTY_UPDATED_METHOD_END
//GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_START
//GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_END
//CUSTOM_STATIC_ON_ENTITY_PROPERTY_UPDATED_METHOD_START
if (!object.entity.underConstruction) {
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_START
// let {object} = object;
if (!object.underConstruction) {
/**
* At this point - the object entity would have been brought to a stop
@ -453,14 +465,14 @@ class SystemLinking extends System {
* We can safely clear the dirty flag.
*/
if (object.entity.dirty) {
object.entity.dirty = false;
if (object.dirty) {
object.dirty = false;
}
object.entity.initializeDepth = 0;
object.entity.initialize();
object.initializeDepth = 0;
object.initialize();
}
//CUSTOM_STATIC_ON_ENTITY_PROPERTY_UPDATED_METHOD_END
//CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_END
}
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**

View File

@ -1,6 +1,6 @@
const Event = require('.././r3-event');
const Utils = require('.././r3-utils');
const System = require('.././r3-system.js');
const System = require('./r3-system.js');
/**

View File

@ -478,7 +478,6 @@ class Utils {
object.height = size.height;
};
/**
* Returns id of object with the name if it exists in the array, otherwise null
* @param name
@ -1117,12 +1116,18 @@ class Utils {
* @constructor
*/
static PushUnique(array, object) {
if (array.indexOf(object) === -1) {
array.push(object);
}
};
static RemoveFromArray(array, object) {
let index = array.indexOf(object);
if (index !== -1) {
array.splice(index, 1);
}
}
/**
* Checks whether or not the object is empty
* @param obj

View File

@ -60,19 +60,17 @@
}
}.bind(this);
this.initialized = true;
for (let requiredProperty in this.required) {
if (this.required.hasOwnProperty(requiredProperty)) {
if (requiredProperty === property) {
if (isReady(property, value)) {
this.initialized = true;
} else {
if (!isReady(property, value)) {
this.initialized = false;
return;
}
} else {
if (isReady(requiredProperty, this[requiredProperty])) {
this.initialized = true;
} else {
if (!isReady(requiredProperty, this[requiredProperty])) {
this.initialized = false;
return;
}

View File

@ -1,6 +1,6 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const R3Object = require('.././r3-r3-object.js');
const R3Object = require('../r3-object/r3-object.js');
/**

View File

@ -1,7 +1,5 @@
constructor(options) {
super(options);
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
@ -14,6 +12,8 @@
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END

View File

@ -1,6 +1,6 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**
@ -9,9 +9,7 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -34,8 +32,6 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START

View File

@ -16,11 +16,11 @@
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END

View File

@ -1,6 +1,6 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const R3Object = require('.././r3-r3-object.js');
const R3Object = require('../r3-object/r3-object.js');
/**

View File

@ -1,6 +1,6 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**
@ -11,11 +11,9 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this Entity has initialized
initializeDepth=0 - The amount of times this Entity passed through initialize() functions
parent=null - The parent R3.Object of this component
components=[] - A list of components that this entity is composed of
started=false - Indicates whether or not this entity is active (subscribing to events) or not
subscriptions={} - An association object which hold the subscription handles for Events this system is listening to. The system can stop receiving events by calling remove() on a handle.
dirty=false - When dirty is true, it means that this entity is in transition from having a Component to not having this Component, and will probably end up in an uninitialized state. During the next few clock cycles this child Component will have its parent reference to this entity removed.
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START

View File

@ -11,18 +11,18 @@
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
Event.OBJECT_PROPERTY_UPDATE,
{
entity : this,
object : this,
property : 'KEY',
value : x
}
);
this.KEYBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
Event.OBJECT_PROPERTY_UPDATED,
{
entity : this,
object : this,
property : 'KEY',
value : x
}

View File

@ -1,6 +1,6 @@
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
if (this instanceof R3.Component && this.initialized) {
this.createInstance();
}

View File

@ -10,9 +10,10 @@ 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
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
parent=null - All Objects could have a parent
parents=[] - All Objects could have parent(s)
children=[] - All Objects could have some children
required={} - All Objects could have some required Objects which need to initialize before this Object can initialize
TEMPLATE_OPTIONS_END

View File

@ -1,7 +1,5 @@
constructor(options) {
super(options);
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
@ -14,6 +12,8 @@
options.maxDepth = options.callDepth;
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END

View File

@ -1,6 +1,6 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**

View File

@ -1,6 +1,6 @@
class R3 {
static version = 'VERSION';
static compileDate = 'DATE';
static Version = 'VERSION';
static CompileDate = 'DATE';
}
//GENERATED_IMPORTS_START

View File

@ -1,6 +1,6 @@
const Event = require('INCLUDE_PATH/r3-event');
const Utils = require('INCLUDE_PATH/r3-utils');
const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME');
/**

View File

@ -53,8 +53,6 @@ GENERATED_STATIC_ON_COMPONENT_INITIALIZED_METHOD
GENERATED_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD
GENERATED_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD
GENERATED_STATIC_ON_ENTITY_INITIALIZED_METHOD
GENERATED_STATIC_ON_ENTITY_PROPERTY_UPDATED_METHOD
GENERATED_STATIC_ON_ENTITY_PROPERTY_UPDATE_METHOD
GENERATED_STATIC_ON_GET_API_URL_METHOD
GENERATED_STATIC_ON_GET_RUNTIME_METHOD
GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD
@ -66,6 +64,8 @@ GENERATED_STATIC_ON_MOUSE_MOVE_METHOD
GENERATED_STATIC_ON_MOUSE_UP_METHOD
GENERATED_STATIC_ON_MOUSE_WHEEL_METHOD
GENERATED_STATIC_ON_OBJECT_CREATED_METHOD
GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD
GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD
GENERATED_STATIC_ON_PROJECT_INITIALIZED_METHOD
GENERATED_STATIC_ON_SLIDER_ENTITY_INITIALIZED_METHOD
GENERATED_STATIC_ON_TOUCH_CANCEL_METHOD
@ -133,7 +133,6 @@ CUSTOM_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD
CUSTOM_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD
CUSTOM_STATIC_ON_ENTITY_INITIALIZED_METHOD
CUSTOM_STATIC_ON_ENTITY_PROPERTY_UPDATED_METHOD
CUSTOM_STATIC_ON_ENTITY_PROPERTY_UPDATE_METHOD
CUSTOM_STATIC_ON_GET_API_URL_METHOD
CUSTOM_STATIC_ON_GET_RUNTIME_METHOD
CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD
@ -145,6 +144,8 @@ CUSTOM_STATIC_ON_MOUSE_MOVE_METHOD
CUSTOM_STATIC_ON_MOUSE_UP_METHOD
CUSTOM_STATIC_ON_MOUSE_WHEEL_METHOD
CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD
CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD
CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD
CUSTOM_STATIC_ON_PROJECT_INITIALIZED_METHOD
CUSTOM_STATIC_ON_SLIDER_ENTITY_INITIALIZED_METHOD
CUSTOM_STATIC_ON_TOUCH_CANCEL_METHOD

View File

@ -1,25 +0,0 @@
const {assert} = require('chai');
describe('Event Tests', () => {
it (
'Tests Events',
() => {
let event = new Event();
let result = event.subscribe(
R3.Event.TEST_EVENT,
() => {
}
);
console.log(result);
assert.typeOf(result, 'string');
}
);
});

View File

@ -1,34 +0,0 @@
const {expect} = require('chai');
const LinkingSystem = require('../src/r3/r3-system-linking');
const System = require('../src/r3/r3-system');
describe('Linking System Tests', () => {
it (
'Tests that the linking system instance of System',
() => {
let linkingSystem = new LinkingSystem();
let result = (linkingSystem instanceof System);
expect(result).to.be.true;
}
);
it (
'Tests that the linking system starts',
() => {
let result = LinkingSystem.start();
expect(result).to.be.true;
}
);
});

View File

@ -1,19 +1,35 @@
const {assert} = require('chai');
const Event = require('../src/r3/r3-event.js');
describe('Event Tests', () => {
describe('R3 Tests', () => {
it (
'Tests Event Subscriptions',
'Tests R3 Loads',
() => {
const R3 = require('../dist/r3-node/');
const R3 = require('../src/r3/');
let result = R3.version();
assert.typeOf(R3.Version, 'string');
assert.typeOf(R3.CompileDate, 'string');
console.log(result);
console.log('R3 Version : ' + R3.Version);
console.log('R3 Compile Date : ' + R3.CompileDate);
}
);
it (
'Tests creation of all components succeed',
() => {
const R3 = require('../src/r3/');
assert.typeOf(R3.Version, 'string');
assert.typeOf(R3.CompileDate, 'string');
console.log('R3 Version : ' + R3.Version);
console.log('R3 Compile Date : ' + R3.CompileDate);
assert.typeOf(result, 'string');
}
);

View File

@ -12,13 +12,13 @@ function to_camel_case_from_upper_underscore($string, $capitalizeFirstCharacter
return $str;
}
function from_camel_case($input) {
function from_camel_case($input, $seperator = '_') {
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
$ret = $matches[0];
foreach ($ret as &$match) {
$match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
}
return implode('_', $ret);
return implode($seperator, $ret);
}
if (isset($argc)) {
@ -68,10 +68,11 @@ if ($argv[1] == 'all') {
}
$folders = [
'src/r3/r3-system/',
'src/r3/r3-component/',
'src/r3/r3-entity/',
'src/r3/r3-object/',
'src/r3/r3-runtime/',
'src/r3/r3-entity/'
'src/r3/r3-system/'
];
foreach ($folders as $folder) {

View File

@ -1 +1 @@
3.0.104
3.0.140

View File

@ -1,28 +0,0 @@
const path = require('path');
module.exports = {
entry: './src/r3/index.js',
output: {
filename: 'r3.js',
path: path.resolve(
__dirname + '/../',
'dist'
)
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
],
},
mode: 'development',
devtool: 'inline-source-map'
};