From: Patrik Gornicz Date: Tue, 19 Aug 2008 00:55:11 +0000 (-0400) Subject: wrp: game state changing X-Git-Tag: physics-premerge~152 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=55e5393b9b8689f4e70f2775e52aad49d805b0c0;p=libbear.git wrp: game state changing --- diff --git a/src/GameStates/GameState.cpp b/src/GameStates/GameState.cpp index 21f5677..cef5a1c 100644 --- a/src/GameStates/GameState.cpp +++ b/src/GameStates/GameState.cpp @@ -28,3 +28,12 @@ GameState::~GameState() { } + +bool GameState::pushMe() const +{ + return false; +} +bool GameState::popMe() const +{ + return false; +} diff --git a/src/GameStates/GameState.h b/src/GameStates/GameState.h index 69a43c4..74dfab1 100644 --- a/src/GameStates/GameState.h +++ b/src/GameStates/GameState.h @@ -32,6 +32,9 @@ class GameState virtual void handleInput(bool=false) const = 0; virtual void update(float, bool=false) const = 0; virtual void draw(bool=false) const = 0; + + virtual bool pushMe() const; + virtual bool popMe() const; }; #endif // GAMESTATE_H diff --git a/src/GameStates/Paused.cpp b/src/GameStates/Paused.cpp index 31cbb7a..ed97101 100644 --- a/src/GameStates/Paused.cpp +++ b/src/GameStates/Paused.cpp @@ -16,6 +16,7 @@ */ #include "Paused.h" +#include "../input/inputManager.h" /// ***** Constructors/Destructors ***** @@ -43,3 +44,18 @@ void Paused::draw(bool on_top) const { // TODO } + +bool Paused::pushMe() const +{ + if (input::isPressed(SDLK_p)) + return true; + + return false; +} +bool Paused::popMe() const +{ + if (input::isPressed(SDLK_p)) + return true; + + return false; +} diff --git a/src/GameStates/Paused.h b/src/GameStates/Paused.h index ad05a17..53931e5 100644 --- a/src/GameStates/Paused.h +++ b/src/GameStates/Paused.h @@ -32,6 +32,9 @@ class Paused : public GameState virtual void handleInput(bool=false) const; virtual void update(float, bool=false) const; virtual void draw(bool=false) const; + + virtual bool pushMe() const; + virtual bool popMe() const; }; #endif // PAUSED_H