-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathParticleSystem.cpp
More file actions
75 lines (47 loc) · 1.2 KB
/
Copy pathParticleSystem.cpp
File metadata and controls
75 lines (47 loc) · 1.2 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* ParticleSystem.cpp
*
* Created on: 2011-02-20
* Author: zapo
*/
#include "ParticleSystem.h"
#include "Emitter.h"
ParticleSystem::ParticleSystem() {
// TODO Auto-generated constructor stub
}
ParticleSystem::~ParticleSystem() {
// TODO Auto-generated destructor stub
}
EmitterPtrList & ParticleSystem::GetEmitters() {
return emitters;
}
void ParticleSystem::Init() {
}
void ParticleSystem::AddEmitter(std::string name, EmitterPtr & emitter) {
emitters[name] = emitter;
}
EmitterPtr & ParticleSystem::GetEmitter(std::string name) {
return emitters[name];
}
void ParticleSystem::Update(float dt) {
eit = emitters.begin();
for(; eit != emitters.end(); eit++) {
Emitter & emitter = *(eit->second);
emitter.Update(dt);
}
}
long ParticleSystem::GetNumLivingParticles() const {
EmitterPtrList::const_iterator it = emitters.begin();
long count = 0;
for(; it != emitters.end(); it++) {
count += (it->second)->GetLivingParticles().size();
}
return count;
}
void ParticleSystem::Render(sf::RenderTarget & target) const {
EmitterPtrList::const_iterator eit = emitters.begin();
for(; eit != emitters.end(); eit++) {
Emitter & emitter = *(eit->second);
target.Draw(emitter);
}
}