aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/ParticleEmitter.cpp
blob: 69f5ace8b5636063ab159ba922469d8e02e4eec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include "ParticleEmitter.hpp"
#include <ctime>

ParticleEmitter::ParticleEmitter(unsigned int maxParticles, unsigned int emissionRate, unsigned int speed, unsigned int speedOffset, unsigned int angle, unsigned int angleOffset)
    : m_maxParticles(maxParticles), m_emissionRate(emissionRate), m_speed(speed), m_speedOffset(speedOffset), m_position{0, 0} {
    std::srand(static_cast<unsigned int>(std::time(nullptr))); // initialize random seed

    m_minAngle = (360 + angle - (angleOffset % 360)) % 360; // calculate minAngle
    m_maxAngle = (360 + angle + (angleOffset % 360)) % 360; // calculate maxAngle

}