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.gzFix Compiler Color AND move Config var
src/systems/compiler_system.cpp | 2 +- src/systems/particle_system.cpp | 4 ++-- src/utils/config.hpp | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/systems/compiler_system.cpp b/src/systems/compiler_system.cpp index 3fbea6e..d5e040d 100644 --- a/src/systems/compiler_system.cpp +++ b/src/systems/compiler_system.cpp @@ -84,7 +84,7 @@ CompilerSystem::push_Line(TextWallList& texts, const std::string& line, float wo Vec3 pos = tf.position; pos.y = start_y; - Text3dPtr t = make_Text3d(clean, Text3d::depth_compiler, 0.003f, pos, ConfigColor::compiler); + Text3dPtr t = make_Text3d(clean, Text3d::depth_compiler, 0.003f, pos, ConfigColor::white); t->yaw = tf.yaw; TextWallPtr wt = cpputils::make_unique<TextWall>(TextWall{ diff --git a/src/systems/particle_system.cpp b/src/systems/particle_system.cpp index 07abea3..d9e0807 100644 --- a/src/systems/particle_system.cpp +++ b/src/systems/particle_system.cpp @@ -6,6 +6,7 @@ #include "entities/camera.hpp" #include "entities/game_object.hpp" +#include "utils/config.hpp" namespace { @@ -24,7 +25,6 @@ Vec3 random_UnitSphere() { return Vec3{ s * SDL_cos(phi), u, s * SDL_sin(phi) }; } -constexpr double GRAVITY = 9.0; // a bit lighter than world gravity (25) constexpr float PARTICLE_HALF = 0.04f; } // namespace @@ -74,7 +74,7 @@ ParticleSystem::update(double dt, p.age += dt; if (p.age >= p.lifetime) { p.alive = false; continue; } - p.vel.y -= GRAVITY * dt; + p.vel.y -= ConfigPhysics::proj_gravity * dt; p.pos.x += p.vel.x * dt; p.pos.y += p.vel.y * dt; diff --git a/src/utils/config.hpp b/src/utils/config.hpp index a33cb0d..181ef0b 100644 --- a/src/utils/config.hpp +++ b/src/utils/config.hpp @@ -21,6 +21,7 @@ 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