forked from Barnold1953/GraphicsTutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParticleEngine2D.cpp
More file actions
39 lines (29 loc) · 818 Bytes
/
ParticleEngine2D.cpp
File metadata and controls
39 lines (29 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "ParticleEngine2D.h"
#include "ParticleBatch2D.h"
#include "SpriteBatch.h"
namespace Bengine {
ParticleEngine2D::ParticleEngine2D() {
// Empty
}
ParticleEngine2D::~ParticleEngine2D() {
for (auto& b : m_batches) {
delete b;
}
}
void ParticleEngine2D::addParticleBatch(ParticleBatch2D* particleBatch) {
m_batches.push_back(particleBatch);
}
void ParticleEngine2D::update(float deltaTime) {
for (auto& b : m_batches) {
b->update(deltaTime);
}
}
void ParticleEngine2D::draw(SpriteBatch* spriteBatch) {
for (auto& b : m_batches) {
spriteBatch->begin();
b->draw(spriteBatch);
spriteBatch->end();
spriteBatch->renderBatch();
}
}
}