X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=blobdiff_plain;f=src%2Fgame.cpp;h=5098ed8f169496665683e0fa0cb8bbb6004dbf33;hp=08f9530d89cdb4fb3f108de3ec1927f75dda8f37;hb=c46074c1fc66612c5ea0bfa1f4441491e296703d;hpb=4a0863f343fa6f68639759494e3c0f0ab8ae2a76 diff --git a/src/game.cpp b/src/game.cpp index 08f9530..5098ed8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -83,18 +83,24 @@ void game::handleInput() { 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++ ) @@ -113,21 +119,18 @@ void game::handleInput() 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;