Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/levels/level/sandbox.cpp

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
src/levels/level/sandbox.cpp 1.1 KB · 42 lines raw
#include "levels/level.hpp"
#include "utils/config.hpp"

namespace
Nimbin
{

Level::Data
Level::build_Sandbox()
{
    return {
        .steps = {
            {
                .grants = { },
                .scene        = {},
                .goal         = Goal::AllOf{},
                .hint    = "Spawn a box with box(x,y,z, hx,hy,hz);",
                .details = R"(This level IS the code you write.

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, 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, 0);

Then press the Compile pult. Edit and recompile freely.)",
                .reset_carry  = true,
                .max_ai_words = 0,
            },
        },
        .name = "Sandbox",
        .desc = "Build the world yourself: compile a library that spawns objects.",
        .source_file = "assets/sandbox.c",
        .dynamic_lib = true,
    };
}

} // namespace Nimbin