bool Paused::pushMe() const
{
- return cfg::pause();
+ return cfg::paused();
}
bool Paused::popMe() const
{
- return cfg::unPause();
+ return !cfg::paused();
}
/// ***** Private Method Headers *****
/// ***** Private Variables *****
+bool fPaused = false;
+
/// ***** Initializers/Cleaners *****
void cfg::init()
/// ***** Public Methods *****
-bool cfg::pause()
-{
- return input::wasPressed(key::pause);
-}
-bool cfg::unPause()
+bool cfg::paused()
{
- return input::wasPressed(key::pause);
+ fPaused = input::wasPressed(key::pause) ? !fPaused : fPaused;
+ return fPaused;
}
bool cfg::endGame()
return input::wasReleased(key::well);
}
+bool cfg::showFPS()
+{
+ return true;
+}
+bool cfg::showUPS()
+{
+ return true;
+}
+
/// ***** Private Methods *****
bool endGame();
- bool pause();
- bool unPause();
+ bool paused();
bool mouseWellFollow();
bool mouseWellOn();
bool mouseWellOff();
+
+ bool showFPS();
+ bool showUPS();
}
#endif // CONFIG_H
// comment out when not debugging
#define DEBUGGING
-// comment out to suppress warnings
-#define WARNINGS
-
-// comment out to prevent FPS and UPS printing
-#define FPSUPS
-
#endif // DEBUG_H
{
creator::handleInput();
+ int last = active_States.size() -1;
- if(running->pushMe())
+ if(active_States[last] != running && running->pushMe())
+ {
push_State = running;
+ }
- if(paused->pushMe())
+ if(active_States[last] != paused && paused->pushMe())
+ {
push_State = paused;
+ }
- if(creating_Polygon->pushMe())
+ if(active_States[last] != creating_Polygon && creating_Polygon->pushMe())
+ {
push_State = creating_Polygon;
+ }
- int last = active_States.size() -1;
for( int i = 0;
i <= last;
i++ )
void game::update(float time_step)
{
- if(push_State != NULL)
- {
- // don't want to pop and push same state, pop wins arbitrary
- if(!pop_State)
- active_States.push_back(push_State);
-
- push_State = NULL;
- }
-
if(pop_State)
{
active_States.pop_back();
pop_State = false;
}
+ if(push_State != NULL)
+ {
+ active_States.push_back(push_State);
+ push_State = NULL;
+ }
+
int last = active_States.size() -1;
for( int i = 0;
i <= last;
last_Second = tickCountMicro();
-#ifdef FPSUPS
- cout << "ups:\t" << ups << endl;
- cout << "fps:\t" << fps << endl;
-#endif
+ if(cfg::showFPS())
+ {
+ cout << "fps:\t" << fps << endl;
+ }
+ if(cfg::showUPS())
+ {
+ cout << "ups:\t" << ups << endl;
+ }
}
}