projects
/
physics.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added using namespace pg to relavent files ... will remove at some point
[physics.git]
/
src
/
effectManager.cpp
diff --git
a/src/effectManager.cpp
b/src/effectManager.cpp
index
2e50c65
..
526debe
100644
(file)
--- a/
src/effectManager.cpp
+++ b/
src/effectManager.cpp
@@
-17,42
+17,43
@@
#include "effectManager.h"
#include "effectManager.h"
+#include <pg/Vector2.h>
+using namespace pg;
+
+#include <set>
+
#include "Effects/Effect.h"
#include "Effects/Gravity.h"
#include "Effects/GravityWell.h"
#include "Effects/Screen.h"
#include "Effects/Effect.h"
#include "Effects/Gravity.h"
#include "Effects/GravityWell.h"
#include "Effects/Screen.h"
-#include "Vector2.h"
#include "input/inputManager.h"
#include "input/inputManager.h"
+#include "config/config.h"
/// ***** Private Variables *****
/// ***** Private Variables *****
-
Effect** effects
;
-
int num
Effects;
+
typedef std::set<Effect*> setEffect
;
+
setEffect active_
Effects;
-GravityWell*
m
ouseWell;
+GravityWell*
pM
ouseWell;
/// ***** Initializers/Cleaners *****
void effect::init()
{
/// ***** Initializers/Cleaners *****
void effect::init()
{
- numEffects = 3;
- effects = new Effect*[numEffects]();
-
- mouseWell = new GravityWell(input::mousePosition());
+ pMouseWell = new GravityWell(Vector2(0,0));
- effects[0] = mouseWell;
- effects[1] = new Gravity();
- effects[2] = new Screen();
+ active_Effects.insert(new Screen());
+ active_Effects.insert(new Gravity());
}
void effect::clean()
{
}
void effect::clean()
{
- for(int i=0; i < numEffects; i++)
+ for( setEffect::iterator it = active_Effects.begin();
+ it != active_Effects.end();
+ it++ )
{
{
- delete effects[i];
+ // TODO !!!!!!!!!
}
}
-
- delete[] effects;
}
/// ***** Public Methods *****
}
/// ***** Public Methods *****
@@
-63,38
+64,50
@@
void effect::update(float)
}
void effect::handleInput()
{
}
void effect::handleInput()
{
- mouseWell->setPosition(input::mousePosition());
+ if(cfg::mouseWellFollow())
+ pMouseWell->setPosition(input::mousePosition());
+
+ if(cfg::mouseWellOn())
+ active_Effects.insert(pMouseWell);
+ if(cfg::mouseWellOff())
+ active_Effects.erase(pMouseWell);
}
}
-Vector2 effect::positionDelta(const PhysicsEntity*
e, float time_s
tep)
+Vector2 effect::positionDelta(const PhysicsEntity*
ppe, float fTimeS
tep)
{
Vector2 acc(0,0);
{
Vector2 acc(0,0);
- for(int i=0; i < numEffects; i++)
+ for( setEffect::iterator it = active_Effects.begin();
+ it != active_Effects.end();
+ it++ )
{
{
- acc +=
effects[i]->positionDelta(e, time_s
tep);
+ acc +=
(*it)->positionDelta(ppe, fTimeS
tep);
}
return acc;
}
}
return acc;
}
-Vector2 effect::velocityDelta(const PhysicsEntity*
e, float time_s
tep)
+Vector2 effect::velocityDelta(const PhysicsEntity*
ppe, float fTimeS
tep)
{
Vector2 acc(0,0);
{
Vector2 acc(0,0);
- for(int i=0; i < numEffects; i++)
+ for( setEffect::iterator it = active_Effects.begin();
+ it != active_Effects.end();
+ it++ )
{
{
- acc +=
effects[i]->velocityDelta(e, time_s
tep);
+ acc +=
(*it)->velocityDelta(ppe, fTimeS
tep);
}
return acc;
}
}
return acc;
}
-Vector2 effect::forceDelta(const PhysicsEntity*
e, float time_s
tep)
+Vector2 effect::forceDelta(const PhysicsEntity*
ppe, float fTimeS
tep)
{
Vector2 acc(0,0);
{
Vector2 acc(0,0);
- for(int i=0; i < numEffects; i++)
+ for( setEffect::iterator it = active_Effects.begin();
+ it != active_Effects.end();
+ it++ )
{
{
- acc +=
effects[i]->forceDelta(e, time_s
tep);
+ acc +=
(*it)->forceDelta(ppe, fTimeS
tep);
}
return acc;
}
return acc;