Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/entities/plate.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/entities/plate.hpp 928 B · 44 lines raw
#pragma once

#include <string>

#include "entities/solid_box.hpp"
#include "utils/light.hpp"
#include "utils/globals.hpp"

namespace
Nimbin
{

class Camera;
class GlRenderer;

struct Plate final : public SolidBox
{
    static constexpr float _HALF_W   = 0.6f;
    static constexpr float _HALF_H   = 0.05f;
    static constexpr float _HALF_D   = 0.6f;

    Vec3   base_pos  {};

    double hover_phase { 0.0 };
    double pulse       { 0.0 };

    bool   active    { false };
    bool   was_active{ false };

    Plate(Vec3 world_pos)
        : SolidBox(
              world_pos,
              Vec3{ _HALF_W, _HALF_H, _HALF_D },
              SDL_FColor{ 0.3f, 1.0f, 0.6f, 1.0f },
              SDL_FColor{ 0.6f, 1.0f, 0.8f, 1.0f },
              false),
        base_pos(world_pos)
    {}

    void tick(double dt);
    void draw(GlRenderer& gl, const Camera& cam, const Light& light) const override;
};

} // namespace Nimbin