From: Patrik Gornicz Date: Fri, 22 Aug 2008 15:31:20 +0000 (-0400) Subject: grav well only follows mouse when space is pressed X-Git-Tag: physics-premerge~133 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=a860c0c739f42bb52b3ad482cec6a57b5484fd71;p=libbear.git grav well only follows mouse when space is pressed --- diff --git a/src/config/config.cpp b/src/config/config.cpp index ae569fa..895c1d9 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -48,4 +48,9 @@ bool cfg::endGame() return input::wasReleased(SDLK_ESCAPE); } +bool cfg::mouseWellOn() +{ + return input::isPressed(SDLK_SPACE); +} + /// ***** Private Methods ***** diff --git a/src/config/config.h b/src/config/config.h index c02a5fc..b13a075 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -26,10 +26,12 @@ namespace cfg void init(); void clean(); + bool endGame(); + bool pause(); bool unPause(); - bool endGame(); + bool mouseWellOn(); } #endif // CONFIG_H diff --git a/src/effectManager.cpp b/src/effectManager.cpp index 2e50c65..b77fc1d 100644 --- a/src/effectManager.cpp +++ b/src/effectManager.cpp @@ -24,6 +24,7 @@ #include "Vector2.h" #include "input/inputManager.h" +#include "config/config.h" /// ***** Private Variables ***** @@ -41,9 +42,9 @@ void effect::init() mouseWell = new GravityWell(input::mousePosition()); - effects[0] = mouseWell; + effects[0] = new Screen(); effects[1] = new Gravity(); - effects[2] = new Screen(); + effects[2] = mouseWell; } void effect::clean() { @@ -63,7 +64,15 @@ void effect::update(float) } void effect::handleInput() { - mouseWell->setPosition(input::mousePosition()); + if(cfg::mouseWellOn()) + { + numEffects = 3; + mouseWell->setPosition(input::mousePosition()); + } + else + { + numEffects = 2; + } } Vector2 effect::positionDelta(const PhysicsEntity* e, float time_step)