Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/wall/wall.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/wall/wall.hpp 1.5 KB · 74 lines raw
#pragma once

#include "text/token.hpp"
#include "utils/config.hpp"
#include "utils/globals.hpp"

namespace
Nimbin
{

namespace Text { class Handler; }

namespace Wall
{
    enum class Position : uint8_t { PosX,    NegX,   PosZ,    NegZ     };
    enum class Role     : uint8_t { Program, Editor, Info,    Compiler };

    class  Surface;
    struct Drop;
    struct Label;
    struct Transform;
}

namespace Wall
{

    Role     role_Of       (Position p);
    Position position_Of   (Role r);
    Vec3     inward_Normal (Wall::Position pos);

    Drop  attach_ToNearestWall(Text::TokenPtr src);
    void  show_TokenInfo      (Text::Handler& info, const std::string& token_text);
    float tilt_TwardEye       (const Vec3& text_pos, const Vec3& eye_pos);

    struct Transform
    {
        Position wall_position;
        Vec3     position;
        float    yaw;
    };

    Transform get_Transform (Role role, float world_scale);
    Vec3      get_Position  (Role role, float world_scale);


    class Surfaces
    {
    public:
        struct Quad {
            DynArray<float> verts;
            DynArray<int>   indices;

            Role       role;
            SDL_FColor color;
            bool       is_editor;

        };

        void generate(float world_scale);
        void draw(GlRenderer& gl, const Camera& cam, const Light& light) const;
    private:
        DynArray<Quad> _walls;
    };

    struct Drop
    {
        Role           role;
        Text::TokenPtr token;
    };


} // namespace Wall

} // namespace Nimbin