From: Patrik Gornicz Date: Thu, 21 Aug 2008 19:35:53 +0000 (-0400) Subject: setup config to be one file X-Git-Tag: physics-premerge~147 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=b1d92c2f86c7da20ef22f9e064ff9b1a2d5ede4e;p=libbear.git setup config to be one file --- diff --git a/deps/configs/.tmp b/deps/config/.tmp similarity index 100% rename from deps/configs/.tmp rename to deps/config/.tmp diff --git a/objs/configs/.tmp b/objs/config/.tmp similarity index 100% rename from objs/configs/.tmp rename to objs/config/.tmp diff --git a/src/GameStates/Paused.cpp b/src/GameStates/Paused.cpp index 8f35c70..20ef061 100644 --- a/src/GameStates/Paused.cpp +++ b/src/GameStates/Paused.cpp @@ -16,7 +16,7 @@ */ #include "Paused.h" -#include "../configs/paused_cfg.h" +#include "../config/config.h" /// ***** Constructors/Destructors ***** @@ -46,9 +46,9 @@ void Paused::draw(bool on_top) const bool Paused::pushMe() const { - return CFG::pause(); + return cfg::pause(); } bool Paused::popMe() const { - return CFG::unPause(); + return cfg::unPause(); } diff --git a/src/Makefile b/src/Makefile index 1e11991..638655a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -45,7 +45,7 @@ SRCS += Effects/Effect.cpp SRCS += Effects/Gravity.cpp SRCS += Effects/Screen.cpp -SRCS += configs/paused_cfg.cpp +SRCS += config/config.cpp SRCS += input/inputManager.cpp diff --git a/src/configs/paused_cfg.cpp b/src/config/config.cpp similarity index 81% rename from src/configs/paused_cfg.cpp rename to src/config/config.cpp index 4b2b001..ae569fa 100644 --- a/src/configs/paused_cfg.cpp +++ b/src/config/config.cpp @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -#include "paused_cfg.h" +#include "config.h" #include "../input/inputManager.h" /// ***** Private Method Headers ***** @@ -23,15 +23,29 @@ /// ***** Initializers/Cleaners ***** +void cfg::init() +{ + // TODO read in config files +} +void cfg::clean() +{ + // TODO save to config files? +} + /// ***** Public Methods ***** -bool CFG::pause() +bool cfg::pause() { return input::wasPressed(SDLK_p); } -bool CFG::unPause() +bool cfg::unPause() { return input::wasPressed(SDLK_p); } +bool cfg::endGame() +{ + return input::wasReleased(SDLK_ESCAPE); +} + /// ***** Private Methods ***** diff --git a/src/configs/paused_cfg.h b/src/config/config.h similarity index 86% rename from src/configs/paused_cfg.h rename to src/config/config.h index 753a250..c02a5fc 100644 --- a/src/configs/paused_cfg.h +++ b/src/config/config.h @@ -16,15 +16,20 @@ */ -#ifndef PAUSED_CFG_H -#define PAUSED_CFG_H +#ifndef CONFIG_H +#define CONFIG_H /// ***** Header Methods ***** -namespace CFG +namespace cfg { + void init(); + void clean(); + bool pause(); bool unPause(); + + bool endGame(); } -#endif // PAUSED_CFG_H +#endif // CONFIG_H diff --git a/src/main.cpp b/src/main.cpp index 60fb834..5381a86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,7 @@ #include "graphics/graphics.h" #include "input/inputManager.h" +#include "config/config.h" /// ***** Private Method Headers ***** @@ -90,6 +91,8 @@ void init() input::init(); + cfg::init(); + #ifdef DEBUGGING cout << "Initialization Complete" << endl; #endif @@ -101,6 +104,8 @@ void clean() cout << "Cleaning up" << endl; #endif + cfg::clean(); + input::clean(); game::clean(); @@ -178,7 +183,7 @@ void handleInput() game::input(); - if(input::wasReleased(SDLK_ESCAPE)) + if(cfg::endGame()) is_Running = false; }