feat(fireworks): infraestructura (manager + pool + render, sin spawn aún)
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// firework_manager.hpp - Gestor de bursts radials (fireworks)
|
||||
// © 2026 JailDesigner
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/rendering/render_context.hpp"
|
||||
#include "core/types.hpp"
|
||||
#include "firework.hpp"
|
||||
|
||||
namespace Effects {
|
||||
|
||||
// Pool de partícules. spawn() emet un burst d'N línies radials des
|
||||
// d'`origen`. Cada partícula viu independent (update/draw/rebot).
|
||||
class FireworkManager {
|
||||
public:
|
||||
explicit FireworkManager(Rendering::Renderer* renderer);
|
||||
|
||||
// Emet un burst radial:
|
||||
// origen: punt central del burst.
|
||||
// color: color de les línies (heretat del pare).
|
||||
// initial_speed: velocitat radial inicial (px/s).
|
||||
// n_points: nombre de línies. Default Defaults::FX::Firework::N_POINTS.
|
||||
// initial_brightness: 0..1.
|
||||
void spawn(const Vec2& origen,
|
||||
SDL_Color color,
|
||||
float initial_speed = Defaults::FX::Firework::SPEED,
|
||||
int n_points = Defaults::FX::Firework::N_POINTS,
|
||||
float initial_brightness = Defaults::FX::Firework::INITIAL_BRIGHTNESS);
|
||||
|
||||
void update(float delta_time);
|
||||
void draw() const;
|
||||
void reset();
|
||||
|
||||
[[nodiscard]] auto getActiveCount() const -> int;
|
||||
|
||||
private:
|
||||
Rendering::Renderer* renderer_;
|
||||
|
||||
static constexpr int POOL_SIZE = Defaults::FX::Firework::POOL_SIZE;
|
||||
std::array<Firework, POOL_SIZE> pool_;
|
||||
|
||||
auto findFreeSlot() -> Firework*;
|
||||
};
|
||||
|
||||
} // namespace Effects
|
||||
Reference in New Issue
Block a user