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