Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/systems/carry_system.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/systems/carry_system.hpp 1001 B · 47 lines raw
#pragma once

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

namespace
Nimbin
{


struct CarriedWordNode
{
    Text::TokenPtr word;
    CarriedWordNode* prev{nullptr};
    cpputils::unique_ptr<CarriedWordNode> next;
    CarriedWordNode(Text::TokenPtr w) : word(std::move(w)) {}
};


struct CarriedLine
{
    cpputils::unique_ptr<CarriedWordNode> first;
    CarriedWordNode* last{nullptr};
    size_t size{0};

    bool empty  () const;
    void clear  ();
    void compact();


    void      push     (Text::TokenPtr w);
    Text::TokenPtr pop_back ();
    Text::TokenPtr pop_front();

    DynArray<CarriedWordNode*>
              nodes        () const;
    DynArray<CarriedWordNode*>
              reverse_nodes() const;

    DynArray<Vec3>
              get_SlotPosition(const Vec3& anchor,
                               const Vec3& right,
                               double carry_gap);
    static Vec3 get_LineAnchor(const Camera& camera, double carry_dist);
};

} // namespace Nimbin