sdl_runtime_compiler git · main
SDL3 game for running and compiling code at runtime
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.gzsrc/entities/pult.hpp raw
#pragma once
#include <string>
#include "entities/solid_box.hpp"
#include "utils/globals.hpp"
#include "utils/light.hpp"
#include "text/handler.hpp"
namespace
Nimbin
{
class Camera;
class GlRenderer;
enum class PultAction : uint8_t {
ScrollEditorUp,
ScrollEditorDown,
ClearEditor,
Compile,
RunProgram,
ConnectProgram,
ConnectEditor,
};
struct PultButton final : public SolidBox
{
std::string label;
PultAction action;
double press_timer { 0.0 };
bool pressed { false };
bool player_on { false };
PultButton(const std::string& lbl, PultAction act, Vec3 world_pos);
void press();
void tick (double dt);
void draw (GlRenderer& gl, const Camera& cam, const Light& light) const override;
};
struct Pult : public SolidBox
{
static constexpr float W = 0.50f;
static constexpr float H = 0.28f;
static constexpr float D = 0.40f;
Text::Handler label;
DynArray<PultButton*>
buttons;
std::string name;
float half_w { W };
float half_d { D };
Pult(const std::string& n, Vec3 world_pos,
float half_width = W, float half_depth = D);
void tick(double dt);
void draw(GlRenderer& gl, const Camera& cam, const Light& light) const override;
};
} // namespace Nimbin