nCine::ParticleInitializer struct

Initialization parameters for a batch of emitted particles.

Each field is a [min, max] range from which a random value is drawn per particle when ParticleSystem::emitParticles() is called. The setter helpers fill these ranges from various argument forms, such as a single value, an explicit interval, a radius or an emission angle.

Public functions

void setAmount(std::int32_t amount)
Sets a fixed number of particles to emit.
void setAmount(std::int32_t minAmount, std::int32_t maxAmount)
Sets the range of the number of particles to emit.
void setLife(float life)
Sets a fixed particle life in seconds.
void setLife(float minLife, float maxLife)
Sets the range of the particle life in seconds.
void setPosition(float x, float y)
Sets a fixed initial position offset.
void setPosition(float minX, float minY, float maxX, float maxY)
Sets the range of the initial position offset.
void setPositionAndRadius(float x, float y, float radius)
Sets a square position range centered on the specified point.
void setPosition(Vector2f pos)
Sets a fixed initial position offset.
void setPosition(Vector2f minPos, Vector2f maxPos)
Sets the range of the initial position offset.
void setPositionAndRadius(Vector2f pos, float radius)
Sets a square position range centered on the specified point.
void setPositionInDisc(float radius)
Sets a square position range centered on the origin.
void setVelocity(float x, float y)
Sets a fixed initial velocity.
void setVelocity(float minX, float minY, float maxX, float maxY)
Sets the range of the initial velocity.
void setVelocityAndRadius(float x, float y, float radius)
Sets a square velocity range centered on the specified vector.
void setVelocityAndScale(float x, float y, float minScale, float maxScale)
Sets a velocity range by scaling the specified vector between two factors.
void setVelocityAndAngle(float x, float y, float angle)
Sets a velocity range by rotating the specified vector by half the given angle in both directions.
void setVelocity(Vector2f vel)
Sets a fixed initial velocity.
void setVelocity(Vector2f minVel, Vector2f maxVel)
Sets the range of the initial velocity.
void setVelocityAndRadius(Vector2f vel, float radius)
Sets a square velocity range centered on the specified vector.
void setVelocityAndScale(Vector2f vel, float minScale, float maxScale)
Sets a velocity range by scaling the specified vector between two factors.
void setVelocityAndAngle(Vector2f vel, float angle)
Sets a velocity range by rotating the specified vector by half the given angle in both directions.
void setRotation(float rot)
Sets a fixed initial rotation in degrees.
void setRotation(float minRot, float maxRot)
Sets the range of the initial rotation in degrees.

Public variables

Vector2i rndAmount
Range of the number of particles to emit.
Vector2f rndLife
Range of the particle life in seconds.
Vector2f rndPositionX
Range of the initial horizontal position offset.
Vector2f rndPositionY
Range of the initial vertical position offset.
Vector2f rndVelocityX
Range of the initial horizontal velocity.
Vector2f rndVelocityY
Range of the initial vertical velocity.
Vector2f rndRotation
Range of the initial rotation in degrees, used only when emitterRotation is false.
bool emitterRotation
Whether particles are rotated to face their emission velocity instead of using rndRotation.