Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / commits / ba39896

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

Restructure files

Christian Immanuel · 2026-05-30 20:39 · ba39896546b7e272618fc782327c2f4ff4d19e7a

 CMakeLists.txt                           |  2 +-
 assets/sandbox.c                         | 28 ++++++++++++++++++++++++++
 {src/assets => assets}/sandbox.c.last_ok |  5 +++--
 src/assets/sandbox.c                     | 34 --------------------------------
 src/levels/level_list.cpp                |  2 +-
 src/states/game_state.cpp                |  2 +-
 src/{assets => systems}/game_mod_abi.h   |  0
 src/systems/mod_loader.hpp               |  6 +++---
 8 files changed, 37 insertions(+), 42 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 076d1a9..7b138ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,7 +138,7 @@ add_custom_target(compile_commands_link ALL
 add_custom_command(TARGET SDL3_RuntimeCompiler POST_BUILD
     COMMAND ${CMAKE_COMMAND} -E make_directory /tmp/game_mod_include
     COMMAND ${CMAKE_COMMAND} -E copy
-        ${CMAKE_SOURCE_DIR}/src/assets/game_mod_abi.h
+        ${CMAKE_SOURCE_DIR}/src/systems/game_mod_abi.h
         /tmp/game_mod_include/game_mod_abi.h)
 
 # ─────────────────────────────────────────────────────────────────────────────
diff --git a/assets/sandbox.c b/assets/sandbox.c
new file mode 100644
index 0000000..e596933
--- /dev/null
+++ b/assets/sandbox.c
@@ -0,0 +1,28 @@
+#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 text ( double x , double y , double z , char * t ) {
+o [ n ] .kind = MOD_TEXT ;
+o [ n ] .x = x ; o [ n ] .y = y ; o [ n ] .z = z ;
+o [ n ] .r = 1 ; o [ n ] .g = 1 ; o [ n ] .b = 1 ;
+int i = 0 ;
+while ( t [ i ] != 0 ) { o [ n ] .text [ i ] = t [ i ] ; i = i + 1 ; }
+o [ n ] .text [ i ] = 0 ;
+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 ) ;
+return n ;
+}
diff --git a/src/assets/sandbox.c.last_ok b/assets/sandbox.c.last_ok
similarity index 90%
rename from src/assets/sandbox.c.last_ok
rename to assets/sandbox.c.last_ok
index f7bff9c..b966a3c 100644
--- a/src/assets/sandbox.c.last_ok
+++ b/assets/sandbox.c.last_ok
@@ -21,7 +21,8 @@ int game_build ( ModObject * out , int max ) {
 ( void ) max ;
 o = out ; n = 0 ;
 box ( 0 , - 16 , 5 , 1 , 1 , 1 ) ;
-text ( 0 , - 15 , 5 , "FUCK" ) ;
-box ( 7 , - 16 , 5 , 4 , 2 , 1 ) ;
+text ( 0 , - 15 , 5 , "hi" ) ;
+box(6,-16,5,1,3,1);
+box ( 3 , - 16 , 7 , 1 , 2 , 1 ) ;
 return n ;
 }
diff --git a/src/assets/sandbox.c b/src/assets/sandbox.c
deleted file mode 100644
index b9ce2d8..0000000
--- a/src/assets/sandbox.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#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 text(double x, double y, double z, char* t) {
-    o[n].kind = MOD_TEXT;
-    o[n].x = x; o[n].y = y; o[n].z = z;
-    o[n].r = 1; o[n].g = 1; o[n].b = 1;
-    int i = 0;
-    while (t[i] != 0) { o[n].text[i] = t[i]; i = i + 1; }
-    o[n].text[i] = 0;
-    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);
-
-
-
-    return n;
-}
diff --git a/src/levels/level_list.cpp b/src/levels/level_list.cpp
index 31b2549..a6b1126 100644
--- a/src/levels/level_list.cpp
+++ b/src/levels/level_list.cpp
@@ -429,7 +429,7 @@ Place all three lines BEFORE the existing return.)",
         .name = "Sandbox",
         .desc = "Build the world yourself: compile a library that spawns objects.",
         .dynamic_lib = true,
-        .source_file = "src/assets/sandbox.c",
+        .source_file = "assets/sandbox.c",
         .steps = {
             {
                 .hint    = "Spawn a box with box(x,y,z, hx,hy,hz);",
diff --git a/src/states/game_state.cpp b/src/states/game_state.cpp
index 9cbbb37..dc15ac0 100644
--- a/src/states/game_state.cpp
+++ b/src/states/game_state.cpp
@@ -3,7 +3,6 @@
 #include <unordered_set>
 
 
-#include "assets/game_mod_abi.h"
 #include "core/game.hpp"
 #include "entities/solid_box.hpp"
 #include "entities/world.hpp"
@@ -11,6 +10,7 @@
 #include "levels/level_check.hpp"
 #include "levels/level_list.hpp"
 #include "rendering/gl_renderer.hpp"
+#include "systems/game_mod_abi.h"
 #include "systems/input_system.hpp"
 #include "systems/physics_system.hpp"
 #include "systems/pick_system.hpp"
diff --git a/src/assets/game_mod_abi.h b/src/systems/game_mod_abi.h
similarity index 100%
rename from src/assets/game_mod_abi.h
rename to src/systems/game_mod_abi.h
diff --git a/src/systems/mod_loader.hpp b/src/systems/mod_loader.hpp
index 048149e..0b1f5ce 100644
--- a/src/systems/mod_loader.hpp
+++ b/src/systems/mod_loader.hpp
@@ -1,12 +1,12 @@
 #pragma once
-#include <string>
+
 #include <cstdio>
+#include <string>
 #include <vector>
 
+#include "systems/game_mod_abi.h"
 #include "wall/text_wall.hpp"
 
-#include "assets/game_mod_abi.h"
-
 class ModLoader
 {
 public: