From: Patrik Gornicz Date: Sun, 7 Dec 2008 20:20:51 +0000 (-0500) Subject: changes to how configs react to input X-Git-Tag: v0.09~13 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=commitdiff_plain;h=2b8199e7bd3d91d151cb54e1e7b04b1c8610ad9a changes to how configs react to input --- diff --git a/configs/keys.cfg b/configs/keys.cfg index 0c6a8f3..3d66889 100644 --- a/configs/keys.cfg +++ b/configs/keys.cfg @@ -1,2 +1,4 @@ -follow=f -well=space +follow = F +well = Space +end = Esc +pause = p diff --git a/src/config/config.cpp b/src/config/config.cpp index 69406bc..bb7ea7a 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -27,7 +27,16 @@ /// ***** Private Method Headers ***** /// ***** Private Variables ***** -bool fPaused = false; +bool fPaused = false; + +bool fEndGame = false; + +bool fWellFollow= false; +bool fWellOn = false; +bool fWellOff = false; + +bool fShowFPS = true; +bool fShowUPS = true; /// ***** Initializers/Cleaners ***** @@ -45,37 +54,47 @@ void cfg::clean() /// ***** Public Methods ***** +void cfg::handleInput() +{ + fPaused = input::wasPressed (key::pause) ? !fPaused : fPaused; + + fEndGame = input::wasReleased(key::end); + + fWellFollow = input::isPressed (key::follow); + fWellOn = input::wasPressed (key::well); + fWellOff = input::wasReleased(key::well); +} + bool cfg::paused() { - fPaused = input::wasPressed(key::pause) ? !fPaused : fPaused; return fPaused; } bool cfg::endGame() { - return input::wasReleased(key::end); + return fEndGame; } bool cfg::mouseWellFollow() { - return input::isPressed(key::follow); + return fWellFollow; } bool cfg::mouseWellOn() { - return input::wasPressed(key::well); + return fWellOn; } bool cfg::mouseWellOff() { - return input::wasReleased(key::well); + return fWellOff; } bool cfg::showFPS() { - return true; + return fShowFPS; } bool cfg::showUPS() { - return true; + return fShowUPS; } /// ***** Private Methods ***** diff --git a/src/config/config.h b/src/config/config.h index 8c7143f..d08a517 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -26,6 +26,8 @@ namespace cfg void init(); void clean(); + void handleInput(); + bool endGame(); bool paused(); diff --git a/src/main.cpp b/src/main.cpp index 0efd748..050aff7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -197,6 +197,7 @@ void handleInput() { input::update(); + cfg::handleInput(); game::handleInput(); if(cfg::endGame())