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

#include "entities/camera.hpp"
#include "entities/game_object.hpp"
#include "text/handler.hpp"
#include "text/token.hpp"
#include "utils/globals.hpp"
#include "wall/wall.hpp"

namespace
Nimbin
{

enum class PickKind : uint8_t { None, Scenery, Word, WallWord };

struct PickResult
{
    size_t word_index { 0 };
    GameObject*        scenery_obj  { nullptr };
    Text::Handler*     wall_handler { nullptr };
    Text::Token::Data* wall_token   { nullptr };
    PickKind           kind         { PickKind::None };

    bool hit() const { return kind != PickKind::None; }
};

namespace PickSystem
{
    PickResult pick(const Camera& camera,
                    const DynArray<Text::TokenPtr>& words,
                    const DynArray<GameObjectPtr>&  scenery,
                    const DynArray<Text::Handler*>& walls);

    Text::Token::Data*
    pick_WallToken(const Camera& camera, Text::Handler& wall);
}

} // namespace Nimbin