Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/systems/input_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/input_system.hpp 1.2 KB · 68 lines raw
#pragma once

#include <SDL3/SDL.h>
#include <string>

#include "utils/globals.hpp"

namespace
Nimbin
{

class Game;


enum class InputCommand : uint8_t
{
    Jump,
    Click,
    FocusToggle,
    Drop,
    ShootAll,
    Compile,
    Run,
    DebugPrint,
    FreelookStart, FreelookEnd,
    NumberInc, NumberDec,
    TypingStart, TypingCommit, TypingCancel,
    SandboxRestore,
    ConnectPultSubmit,
    ConnectPultExit,
};


struct FrameInput
{
    bool forward  = false;
    bool backward = false;
    bool left     = false;
    bool right    = false;
    bool pick     = false;
    bool shoot    = false;// X held: focus the faced wall

    bool vim_normal_keys = false;

    bool capture_typing  = false;
    bool capture_vim     = false;

    bool typing_mode   = false;
    bool typing_commit = false;
    bool typing_cancel = false;

    int    look_x   = 0;
    int    look_y   = 0;
    double scroll_x = 0.0;
    double scroll_y = 0.0;

    std::string            typing_buffer;
    DynArray<int>          vim_keys;
    DynArray<InputCommand> commands;
};


struct InputSystem
{
    void handle_Event(Game& game, const SDL_Event& e, FrameInput& input);
};

} // namespace Nimbin