Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/utils/config.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/utils/config.hpp 6.9 KB · 168 lines raw
#pragma once

#include <SDL3/SDL.h>

namespace
Nimbin
{

namespace
Config
{

namespace Game
{
static constexpr float world_box_scale = 16.f;
}


namespace Physics
{
static constexpr double binrad    = SDL_PI_D / 2147483648.0;
static constexpr double proj_grav = 15.0;
static constexpr double air_drag  = 0.993;

static constexpr double shoot_speed = 34.0;
static constexpr double stick_dist  =  0.2;

static constexpr double player_jump_velocity = 8.4375;
static constexpr double player_move_accel    = 60.0;

static constexpr double proj_gravity     = 9.0;
static constexpr double proj_throw_speed = 18.0;
static constexpr double proj_t_min       = 0.18;  // clamp: nearest  throws
static constexpr double proj_t_max       = 1.2;   // clamp: farthest throws
}


namespace Carry
{
static constexpr double dist = 1.2;
static constexpr double gap  = 0.18;

static constexpr double hand_right = 0.45;
static constexpr double hand_down  = 0.35;
}

namespace Color
{
    static inline constexpr SDL_FColor keep    = {0.0f, -1.0f, 0.0f,  1.0f};
    static inline constexpr SDL_FColor attack  = {1.0f, 0.35f, 0.2f,  1.0f};
    static inline constexpr SDL_FColor flee    = {1.0f, 0.95f, 0.4f,  1.0f};
    static inline constexpr SDL_FColor stunned = {0.45f, 0.45f, 0.5f, 1.0f};

    static inline constexpr SDL_FColor white   = {1.0f, 1.0f, 1.0f, 1.0f};
    static inline constexpr SDL_FColor red     = {1.0f, 0.0f, 0.0f, 1.0f};
    static inline constexpr SDL_FColor green   = {0.30f, 0.70f, 0.40f, 1.0f};
    static inline constexpr SDL_FColor blue    = {0.0f, 0.86f, 1.0f, 1.0f};
    static inline constexpr SDL_FColor yellow  = {1.0f, 1.0f, 0.0f, 1.0f};
    static inline constexpr SDL_FColor cyan    = {0.0f, 1.0f, 1.0f, 1.0f};
    static inline constexpr SDL_FColor magenta = {1.0f, 0.0f, 1.0f, 1.0f};
    static inline constexpr SDL_FColor black   = {0.0f, 0.0f, 0.0f, 1.0f};
    static inline constexpr SDL_FColor gray    = {0.5f, 0.5f, 0.5f, 1.0f};
    static inline constexpr SDL_FColor soft_blue   = {0.55f, 0.72f, 0.92f, 1.0f};
    static inline constexpr SDL_FColor slate_blue  = {0.42f, 0.52f, 0.63f, 1.0f};
    static inline constexpr SDL_FColor orange      = {1.0f,  0.55f, 0.10f, 1.0f};
    static inline constexpr SDL_FColor amber       = {1.0f,  0.75f, 0.20f, 1.0f};
    static inline constexpr SDL_FColor lime        = {0.65f, 0.95f, 0.25f, 1.0f};
    static inline constexpr SDL_FColor teal        = {0.0f,  0.65f, 0.60f, 1.0f};
    static inline constexpr SDL_FColor sky         = {0.40f, 0.70f, 1.0f,  1.0f};
    static inline constexpr SDL_FColor pale_sky    = {0.80f, 0.90f, 1.00f, 1.0f};
    static inline constexpr SDL_FColor indigo      = {0.30f, 0.30f, 0.80f, 1.0f};
    static inline constexpr SDL_FColor deep_indigo = {0.06f, 0.05f, 0.12f, 1.0f};
    static inline constexpr SDL_FColor light_indigo= {0.70f, 0.65f, 1.00f, 1.0f};
    static inline constexpr SDL_FColor warm_ivory  = {0.95f, 0.92f, 0.82f, 1.0f};
    static inline constexpr SDL_FColor purple      = {0.60f, 0.30f, 0.85f, 1.0f};
    static inline constexpr SDL_FColor pink        = {1.0f,  0.34f, 0.87f, 1.0f};
    static inline constexpr SDL_FColor brown       = {0.55f, 0.35f, 0.20f, 1.0f};
    static inline constexpr SDL_FColor dark_gray   = {0.25f, 0.25f, 0.25f, 1.0f};
    static inline constexpr SDL_FColor light_gray  = {0.82f, 0.82f, 0.82f, 1.0f};
    static inline constexpr SDL_FColor cream_paper = {0.066f, 0.113f, 0.18f, 1.0f};
    static inline constexpr SDL_FColor bronze_ink  = {0.48f, 0.36f, 0.16f, 1.0f};

    static inline constexpr SDL_FColor code_unset     = {0.8235f, 0.8784f, 0.8824f, 1.0f};
    static inline constexpr SDL_FColor code_type      = {0.098f, 0.796f, 0.0f, 1.0f};
    static inline constexpr SDL_FColor code_literal   = {0.8f, 0.016f, 0.012f, 1.0f};
    static inline constexpr SDL_FColor code_preproc   = {0.7961f, 0.1176f, 0.8196f, 1.0f};
    static inline constexpr SDL_FColor code_comment   = {0.1529f, 0.4824f, 0.7725f, 1.0f};
    static inline constexpr SDL_FColor code_keyword   = {0.6863f, 0.3725f, 0.0f, 1.0f};


    static inline constexpr SDL_FColor floor    = blue;
    static inline constexpr SDL_FColor wall     = green;

    static inline constexpr SDL_FColor compiler       = deep_indigo;
    static inline constexpr SDL_FColor compiler_label = light_indigo;
    static inline constexpr SDL_FColor info           = slate_blue;
    static inline constexpr SDL_FColor info_label     = pale_sky;
    static inline constexpr SDL_FColor program        = warm_ivory;
    static inline constexpr SDL_FColor program_label  = bronze_ink;
    static inline constexpr SDL_FColor editor         = cream_paper;
    static inline constexpr SDL_FColor editor_label   = soft_blue;
}


namespace Text3d
{
static constexpr double hover_amp   = 0.3;
static constexpr double hover_speed = 1.5;

static constexpr double jiggle_stiff    = 80.0;
static constexpr double jiggle_damp     = 9.0;
static constexpr double jiggle_max_off  = 0.35;
static constexpr double kick_strength   = 0.18;

static constexpr float  word_gap        = 0.25f;
}


namespace Ai
{
static constexpr double drop_loot_probability = 0.35;
static constexpr double trigger_range      =  6.0;
static constexpr double idle_aggro_roll    =  0.4; // per-second chance × aggressiveness
static constexpr double flee_bias          =  0.35;// fraction of state changes that are flee vs attack
static constexpr double stunned_duration   =  1.2;
static constexpr double flee_escape_dist   = 10.0;
static constexpr double flee_escape_time   =  2.0;
static constexpr double steal_probability  =  0.5; // chance per contact
static constexpr double velocity_lerp_rate =  6.0;
static constexpr double wiggle_amplitude   =  0.8;
}

namespace Level
{
static constexpr double settle_time_for_step = 0.25;// 250ms grace period
}

namespace Wall
{
static constexpr float text_offset       = 0.1f;   // distance from wall surface
static constexpr float max_tilt          = 0.90f;
static constexpr float text_line_spacing = 0.45f;

static constexpr float scroll_step       = 0.5f;

static constexpr double line_height      = 0.4 + static_cast<double>(text_line_spacing);
static constexpr double snap_threshold_y = line_height*0.3;  // 30% of line height
static constexpr double word_gap         = 0.12;  // horizontal gap between snapped words
static constexpr double free_space_dist  = 0.18;
static constexpr double underline_drop   = 0.04;  // small gap below letter baseline
static constexpr double underline_thick  = 0.005; // half-height of the underline strip

static constexpr double line_number_gap   = 1.2;    // clear space between code and the numbers
static constexpr float  line_number_scale = 0.003f;
static constexpr double bounce_impulse    = 2.2;  // upward kick when a number is shot
static constexpr double merge_top_margin  = 0.20; // how much space to the top to merge with current line
}


namespace Pult
{
static constexpr double press_dur    = 0.18;
static constexpr double label_height = 1.1;
}

} // namespace Config

} // namespace Nimbin