Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / commits / 9eb28aa

sdl_runtime_compiler git · main

SDL3 game for running and compiling code at runtime

sdl3 c++ compiler dlopen cmake · first commit 2026-04-19 · last commit 2026-07-03 (3 months ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-runtime-compiler

C++ 72.3% C 26.2%
git clone https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler/archive/sdl_runtime_compiler.tar.gz

Add Dynamic mode to sandbox boxes

Christian Immanuel · 2026-05-31 09:09 · 9eb28aa375f653aac7774e5dec53bc915d98f6c7

 assets/sandbox.c          | 19 +++++++++++--------
 assets/sandbox.c.last_ok  | 13 ++++++++-----
 src/levels/level_list.cpp |  6 +++---
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/assets/sandbox.c b/assets/sandbox.c
index 13c5095..00fa869 100644
--- a/assets/sandbox.c
+++ b/assets/sandbox.c
@@ -1,12 +1,15 @@
 # include "game_mod_abi.h"
 static int n ;
 static ModObject * o ;
-static void box ( double x , double y , double z , double hx , double hy , double hz ) {
-o [ n ] .kind = MOD_BOX ;
-o [ n ] .x = x ; o [ n ] .y = y ; o [ n ] .z = z ;
-o [ n ] .hx = hx ; o [ n ] .hy = hy ; o [ n ] .hz = hz ;
-o [ n ] .r = 0.6 ; o [ n ] .g = 0.6 ; o [ n ] .b = 0.8 ;
-n = n + 1 ;
+static void box ( double x , double y , double z , double w , double h , double d , int dyn ) {
+    o[n].kind = MOD_BOX; o[n].dynamic = dyn;
+    double hx = w * 0.5, hy = h * 0.5, hz = d * 0.5;
+    o[n].x = x;
+    o[n].y = y + hy;
+    o[n].z = z;
+    o[n].hx = hx; o[n].hy = hy; o[n].hz = hz;
+    o[n].r = 0.6; o[n].g = 0.6; o[n].b = 0.8;
+    n = n + 1;
 }
 static void text ( double x , double y , double z , char * t ) {
 o [ n ] .kind = MOD_TEXT ;
@@ -20,8 +23,8 @@ n = n + 1 ;
 int game_build ( ModObject * out , int max ) {
 ( void ) max ;
 o = out ; n = 0 ;
-box ( 0 , - 16 , 5 , 1 , 1 , 1, 0 ) ;
 text ( 0 , - 15 , 5 , "hi" ) ;
-box ( 3 , - 16 , 5 , 1 , 6 , 1, 0 ) ;
+box ( 0 , - 16 , 5 , 2 , 1 , 2, 0 ) ;
+box ( 3 , - 16 , 5 , 2 , 2 , 2, 0 ) ;
 return n ;
 }
diff --git a/assets/sandbox.c.last_ok b/assets/sandbox.c.last_ok
index a6049fc..aa2846b 100644
--- a/assets/sandbox.c.last_ok
+++ b/assets/sandbox.c.last_ok
@@ -1,9 +1,12 @@
 # include "game_mod_abi.h"
 static int n ;
 static ModObject * o ;
-static void box ( double x , double y , double z , double hx , double hy , double hz ) {
-o [ n ] .kind = MOD_BOX ;
-o [ n ] .x = x ; o [ n ] .y = y ; o [ n ] .z = z ;
+static void box ( double x , double y , double z , double w , double h , double d , int dyn ) {
+o [ n ] .kind = MOD_BOX ; o [ n ] .dynamic = dyn ;
+double hx = w * 0.5 , hy = h * 0.5 , hz = d * 0.5 ;
+o [ n ] .x = x ;
+o [ n ] .y = y + hy ;
+o [ n ] .z = z ;
 o [ n ] .hx = hx ; o [ n ] .hy = hy ; o [ n ] .hz = hz ;
 o [ n ] .r = 0.6 ; o [ n ] .g = 0.6 ; o [ n ] .b = 0.8 ;
 n = n + 1 ;
@@ -20,8 +23,8 @@ n = n + 1 ;
 int game_build ( ModObject * out , int max ) {
 ( void ) max ;
 o = out ; n = 0 ;
-box ( 0 , - 16 , 5 , 1 , 1 , 1 ) ;
 text ( 0 , - 15 , 5 , "hi" ) ;
-box ( 3 , - 16 , 5 , 1 , 2 , 1 ) ;
+box ( 0 , - 16 , 5 , 2 , 1 , 2 , 0 ) ;
+box ( 3 , - 16 , 5 , 2 , 2 , 2 , 0 ) ;
 return n ;
 }
diff --git a/src/levels/level_list.cpp b/src/levels/level_list.cpp
index a6b1126..7d4b63a 100644
--- a/src/levels/level_list.cpp
+++ b/src/levels/level_list.cpp
@@ -439,11 +439,11 @@ The editor wall is a C library. When you Compile, the game
 rebuilds it and spawns whatever your code describes.
 
 Two helpers are available:
-  box(x, y, z,  hx, hy, hz);   - a solid box at (x,y,z), half-size (hx,hy,hz)
-  text(x, y, z, "word");       - floating text at (x,y,z)
+  box(x, y, z,  hx, hy, hz, dy); - a solid box at (x,y,z), half-size (hx,hy,hz), is_dynamic (dy)
+  text(x, y, z, "word");         - floating text at (x,y,z)
 
 Build something like:
-  box(0, 5, -3,  1, 1, 1);
+  box(0, 5, -3,  1, 1, 1, 0);
 
 Then press the Compile pult. Edit and recompile freely.)",
                 .grants = { },