From a860c0c739f42bb52b3ad482cec6a57b5484fd71 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Fri, 22 Aug 2008 11:31:20 -0400 Subject: [PATCH] grav well only follows mouse when space is pressed --- src/config/config.cpp | 5 +++++ src/config/config.h | 4 +++- src/effectManager.cpp | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) 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) -- 2.10.2