diff options
author | jaroWMR <jarorutjes07@gmail.com> | 2024-10-20 12:59:18 +0200 |
---|---|---|
committer | jaroWMR <jarorutjes07@gmail.com> | 2024-10-20 12:59:18 +0200 |
commit | 0f03cdbf23f57116b7664a7c98c4605fd69bb961 (patch) | |
tree | 6e592bd7e94cd5954a8a49209de815fc0ae0becd /src/crepe/ParticleSystem.cpp | |
parent | 016070d47f2fff8cfdd49cc0bdf65c14ef922c94 (diff) |
updated particle system
Diffstat (limited to 'src/crepe/ParticleSystem.cpp')
-rw-r--r-- | src/crepe/ParticleSystem.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/crepe/ParticleSystem.cpp b/src/crepe/ParticleSystem.cpp index 3a1f653..0dad4cd 100644 --- a/src/crepe/ParticleSystem.cpp +++ b/src/crepe/ParticleSystem.cpp @@ -1,8 +1,6 @@ #include "ParticleSystem.h" #include <cmath> -// #include <cstdlib> #include <ctime> -#include <iostream> // include iostream for std::cout #include "ParticleEmitter.h" #include "Particle.h" #include "ComponentManager.h" @@ -11,7 +9,10 @@ using namespace crepe; ParticleSystem::ParticleSystem() : m_elapsedTime(0.0f) {} // Initialize m_elapsedTime to 0 -void ParticleSystem::update(float deltaTime, std::vector<std::reference_wrapper<ParticleEmitter>>& emitters) { +void ParticleSystem::update() { + ComponentManager& mgr = ComponentManager::get_instance(); + std::vector<std::reference_wrapper<ParticleEmitter>> emitters = mgr.get_components_by_type<ParticleEmitter>(); + float deltaTime = 0.10; for (ParticleEmitter& emitter : emitters) { float updateAmount = 1/static_cast<float>(emitter.m_emissionRate); for (float i = 0; i < deltaTime; i += updateAmount) |