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/systems/freelook_system.cpp raw
#include <SDL3/SDL.h>
#include <algorithm>
#include "freelook_system.hpp"
namespace
Nimbin
{
static constexpr double
FREELOOK_LERP_DUR = 0.20;
void
FreelookSystem::begin()
{
state.active = true;
state.lerping = false;
}
void
FreelookSystem::end()
{
state.active = false;
state.lerping = true;
state.lerp_t = 0.0;
}
void
FreelookSystem::update(double dt)
{
if (!state.lerping) return;
state.lerp_t += dt / FREELOOK_LERP_DUR;
if (state.lerp_t >= 1.0) {
state.lerp_t = 1.0;
state.lerping = false;
}
}
} // namespace Nimbin