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/particle_system.hpp raw
#pragma once
#include <SDL3/SDL.h>
#include "rendering/gl_renderer.hpp"
#include "utils/globals.hpp"
#include "utils/light.hpp"
namespace
Nimbin
{
class Camera;
class GameObject;
struct Particle
{
SDL_FColor color { 1.0f, 1.0f, 1.0f, 1.0f };
Vec3 pos{};
Vec3 vel{};
double age { 0.0 };
double lifetime { 1.5 };
float yaw { 0.0f };
float spin { 0.0f };
bool alive { true };
};
class ParticleSystem
{
DynArray<Particle> _particles;
public:
void update(double dt,
const DynArray<GameObject*>& solid_colliders,
float world_scale);
void clear ();
bool empty () const { return _particles.empty(); }
void draw (GlRenderer& gl, const Camera& cam, const Light& light) const;
void emit_FireworkBurst(const Vec3& center, SDL_FColor color, int count = 80);
};
} // namespace Nimbin