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

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.hpp 1.5 KB · 81 lines raw
#pragma once

#include <string>

#include "goal.hpp"
#include "scene.hpp"
#include "utils/globals.hpp"

namespace
Nimbin
{

namespace Level
{
    namespace Check
    {
        std::string normalize(const std::string& s);
        bool        contains_Pattern(const std::string& haystack,
                                     const std::string& needle);
    }


    struct TokenGrant
    {
        DynArray<std::string>
             choices;
        static TokenGrant give(const std::string& text)
                            { return { { text } }; }
        static TokenGrant choice(std::initializer_list<std::string> options)
                            { return { options }; }
    };


    struct Step
    {
        DynArray<TokenGrant>
                    grants{};
        Scene::Data scene{};
        Goal::Type  goal = Goal::AllOf{};

        std::string hint{};
        std::string details{};

        bool reset_carry  = false;
        int  max_ai_words = 5;

    };


    struct Data
    {
        DynArray<Step> steps {};

        std::string name{};
        std::string desc{};
        std::string source_file{};

        bool dynamic_lib = false;
    };

    extern Data build_CharCopy();
    extern Data build_Sandbox ();
    extern Data build_Tutorial();

    inline const DynArray<Data>
    levels = {
        build_CharCopy(),
        build_Sandbox (),
        build_Tutorial(),
    };

    inline const Data&
    get_Data(size_t i)
        { return levels[i]; }
    inline size_t
    get_Count()
        { return levels.size(); }

}

} // namespace Nimbin