From 855f964bff5a53d248e1896c9d020c394ec6c9b7 Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Wed, 8 Sep 2021 05:33:01 +0200 Subject: [PATCH] generate component and runtime defines --- dist/r3.js | 21 +++++++++++++++++- r3.php | 34 +++++++++++++++++++++++++++++ src/r3/r3-component/r3-component.js | 4 ++++ src/r3/r3-r3.js | 2 +- src/r3/r3-runtime/r3-runtime.js | 13 +++++++++++ 5 files changed, 72 insertions(+), 2 deletions(-) diff --git a/dist/r3.js b/dist/r3.js index f83baa1..3293585 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { 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 @@ -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 diff --git a/r3.php b/r3.php index c579bff..278406c 100755 --- a/r3.php +++ b/r3.php @@ -1486,6 +1486,32 @@ function buildNodeList($file) 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() @@ -1664,6 +1690,14 @@ if ($argv[2] == 'build-dist') { updateParentSystems($nodes); + generateOutOfClassImplementationDefines( + $graph, + [ + 'Component', + 'Runtime' + ] + ); + generateR3($nodes, $graph); generateR3Dist($nodes); diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 906be61..09bf872 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -277,6 +277,10 @@ class Component extends R3Object { } //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 //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index 5aa6840..e388488 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { 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 diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index a93d88b..fbf6e57 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -133,6 +133,19 @@ class Runtime extends Event { } //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 //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START