generate component and runtime defines

master
Theunis J. Botha 2021-09-08 05:33:01 +02:00
parent 7c12d4efdd
commit 855f964bff
5 changed files with 72 additions and 2 deletions

21
dist/r3.js vendored
View File

@ -1,6 +1,6 @@
class R3 { class R3 {
static version = '2.0.202'; static version = '2.0.202';
static compileDate = '2021 Sep 08 - 05:07:45 am'; static compileDate = '2021 Sep 08 - 05:32:17 am';
} }
/** /**
@ -2313,6 +2313,20 @@ class Runtime extends Event {
} }
Runtime.Coder = 0x0;
Runtime.CodeMirror = 0x1;
Runtime.Default = 0x2;
Runtime.GUI = 0x3;
Runtime.ControlKit = 0x4;
Runtime.Graphics = 0x5;
Runtime.Three = 0x6;
Runtime.Physics = 0x7;
Runtime.Bullet = 0x8;
Runtime.Socket = 0x9;
Runtime.Statistics = 0xa;
Runtime.Stats = 0xb;
Runtime.MAX_RUNTIMES = 0xc;
/** /**
Class R3.Event.Object Class R3.Event.Object
@ -3342,6 +3356,11 @@ class Component extends R3Object {
} }
Component.Image = 0x0;
Component.Input = 0x1;
Component.Touch = 0x2;
Component.MAX_COMPONENTS = 0x3;
/** /**
Class R3.Event.Object.Project Class R3.Event.Object.Project

34
r3.php
View File

@ -1486,6 +1486,32 @@ function buildNodeList($file)
fclose($fn); fclose($fn);
}
function generateOutOfClassImplementationDefines($graph, $types)
{
foreach ($types as $type) {
$parent = $graph->search('name', $type);
$children = $graph->flatten($parent);
$updateList = [];
$i = 0;
foreach ($children as $child) {
array_push($updateList, $parent->name . '.' . $child->name . ' = 0x' . dechex($i) . ";\n");
$i++;
}
array_push($updateList, $parent->name . '.MAX_' . strtoupper($parent->name) . 'S = 0x' . dechex($i) . ";\n");
updateSection($parent->file, 'GENERATED_OUT_OF_CLASS_IMPLEMENTATION' , $updateList);
}
} }
//function generateRuntimes() //function generateRuntimes()
@ -1664,6 +1690,14 @@ if ($argv[2] == 'build-dist') {
updateParentSystems($nodes); updateParentSystems($nodes);
generateOutOfClassImplementationDefines(
$graph,
[
'Component',
'Runtime'
]
);
generateR3($nodes, $graph); generateR3($nodes, $graph);
generateR3Dist($nodes); generateR3Dist($nodes);

View File

@ -277,6 +277,10 @@ class Component extends R3Object {
} }
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
Component.Image = 0x0;
Component.Input = 0x1;
Component.Touch = 0x2;
Component.MAX_COMPONENTS = 0x3;
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START

View File

@ -1,6 +1,6 @@
class R3 { class R3 {
static version = '2.0.202'; static version = '2.0.202';
static compileDate = '2021 Sep 08 - 05:07:45 am'; static compileDate = '2021 Sep 08 - 05:32:17 am';
} }
//GENERATED_IMPORTS_START //GENERATED_IMPORTS_START

View File

@ -133,6 +133,19 @@ class Runtime extends Event {
} }
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START
Runtime.Coder = 0x0;
Runtime.CodeMirror = 0x1;
Runtime.Default = 0x2;
Runtime.GUI = 0x3;
Runtime.ControlKit = 0x4;
Runtime.Graphics = 0x5;
Runtime.Three = 0x6;
Runtime.Physics = 0x7;
Runtime.Bullet = 0x8;
Runtime.Socket = 0x9;
Runtime.Statistics = 0xa;
Runtime.Stats = 0xb;
Runtime.MAX_RUNTIMES = 0xc;
//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START