gravity working through manager
[physics.git] / src / effectManager.cpp
CommitLineData
f206d19d
PG
1#include "effectManager.h"
2
33b8c69b 3#include "Effects/Effect.h"
f206d19d
PG
4#include "Effects/Gravity.h"
5
33b8c69b
PG
6/// ***** Private Variables *****
7Effect** effects;
8int numEffects;
9
10/// ***** Public Methods *****
11
12void effect::init()
13{
14 numEffects = 1;
15 effects = new Effect*[numEffects]();
16
17 effects[0] = new Gravity();
18}
19void effect::clean()
20{
21 for(int i=0; i < numEffects; i++)
22 {
23 delete effects[i];
24 }
25
26 delete effects;
27}
f206d19d
PG
28
29Vector2 effect::positionDelta(const PhysicsEntity* e, float time_step)
30{
33b8c69b
PG
31 Vector2 acc(0,0);
32
33 for(int i=0; i < numEffects; i++)
34 {
35 acc += effects[i]->positionDelta(e, time_step);
36 }
37
38 return acc;
f206d19d
PG
39}
40Vector2 effect::velocityDelta(const PhysicsEntity* e, float time_step)
41{
33b8c69b
PG
42 Vector2 acc(0,0);
43
44 for(int i=0; i < numEffects; i++)
45 {
46 acc += effects[i]->velocityDelta(e, time_step);
47 }
48
49 return acc;
f206d19d
PG
50}
51Vector2 effect::forceDelta(const PhysicsEntity* e, float time_step)
52{
33b8c69b
PG
53 Vector2 acc(0,0);
54
55 for(int i=0; i < numEffects; i++)
56 {
57 acc += effects[i]->forceDelta(e, time_step);
58 }
59
60 return acc;
f206d19d 61}