8#include <aegis2d/render/export.hpp>
40 float spread = 2.0F * std::numbers::pi_v<float>;
95 void set_position(
Vec2 position) noexcept;
99 [[nodiscard]]
Vec2 position() const noexcept;
103 void set_emitting(
bool emitting) noexcept;
107 [[nodiscard]]
bool emitting() const noexcept;
117 void update(
float seconds);
121 [[nodiscard]]
std::span<const
Particle> particles() const noexcept;
124 void clear() noexcept;
129 [[nodiscard]]
float size(const
Particle& particle) const noexcept;
150 core::Random random_;
152 Vec2 position_{0.0F, 0.0F};
153 float pending_ = 0.0F;
154 bool emitting_ =
true;
What the game draws with, whatever the graphics API behind it.
Definition renderer.hpp:81
Spawns particles at a point, moves them and removes them at the end of their life.
Definition particles.hpp:80
ParticleEmitter(const EmitterConfig &config, std::uint64_t seed=1)
Creates an emitter at (0, 0), emitting, with no particle yet.
const EmitterConfig & config() const noexcept
How particles are spawned and change.
RGBA color used by the renderer.
Vector and matrix types of the engine (GLM behind engine names).
OpenGL renderer: sprites, text and camera (client only).
Definition bitmap_font.hpp:16
aegis2d::Vec2 Vec2
2D vector of floats, in logical pixels: the engine-wide aegis2d::Vec2.
Definition renderer.hpp:17
std::uint32_t TextureId
Identifier of a texture loaded by the resource manager.
Definition renderer.hpp:32
constexpr Color rgb(std::uint32_t hex, float alpha=1.0F) noexcept
Color from its hexadecimal sRGB code, as design tools and palettes give it.
Definition color.hpp:25
Definition endpoint.hpp:85
Seeded random numbers that are the same on every platform.
Backend-independent renderer interface and the sprite it draws.
RGBA color with components in [0, 1].
Definition color.hpp:10
How an emitter spawns its particles, and how they change over their life.
Definition particles.hpp:28
Color start_color
Color at its birth.
Definition particles.hpp:46
Range lifetime
Life of each particle, in seconds.
Definition particles.hpp:32
float spread
Width of the cone of directions around direction, in radians: 0 for a straight jet,...
Definition particles.hpp:40
float rate
Particles spawned per second while emitting; 0 for bursts only.
Definition particles.hpp:30
std::size_t max_particles
Most particles alive at once; spawns past it are dropped.
Definition particles.hpp:50
float end_size
Side of a particle at the end of its life.
Definition particles.hpp:44
float direction
Middle of the directions particles leave in, in radians: 0 to the right, pi / 2 down (y grows downwar...
Definition particles.hpp:37
Color end_color
Color at the end of its life, such as transparent to fade out.
Definition particles.hpp:48
float start_size
Side of a particle at its birth, in logical pixels.
Definition particles.hpp:42
Range speed
Speed of each particle at its birth, in logical pixels per second.
Definition particles.hpp:34
One particle of an emitter.
Definition particles.hpp:54
Vec2 velocity
Velocity, in logical pixels per second.
Definition particles.hpp:58
float age
Seconds since its birth.
Definition particles.hpp:60
Vec2 position
Center, in logical pixels.
Definition particles.hpp:56
float lifetime
Seconds it lives in all.
Definition particles.hpp:62
Values picked at random between two bounds, both included.
Definition particles.hpp:20
float max
Largest value; equal to min for a fixed value.
Definition particles.hpp:24
float min
Smallest value.
Definition particles.hpp:22