projects
/
physics.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reworked ups/fps/paused logic
[physics.git]
/
src
/
game.cpp
diff --git
a/src/game.cpp
b/src/game.cpp
index
08f9530
..
5098ed8
100644
(file)
--- a/
src/game.cpp
+++ b/
src/game.cpp
@@
-83,18
+83,24
@@
void game::handleInput()
{
creator::handleInput();
{
creator::handleInput();
+ int last = active_States.size() -1;
- if(running->pushMe())
+ if(active_States[last] != running && running->pushMe())
+ {
push_State = running;
push_State = running;
+ }
- if(paused->pushMe())
+ if(active_States[last] != paused && paused->pushMe())
+ {
push_State = paused;
push_State = paused;
+ }
- if(creating_Polygon->pushMe())
+ if(active_States[last] != creating_Polygon && creating_Polygon->pushMe())
+ {
push_State = creating_Polygon;
push_State = creating_Polygon;
+ }
- int last = active_States.size() -1;
for( int i = 0;
i <= last;
i++ )
for( int i = 0;
i <= last;
i++ )
@@
-113,21
+119,18
@@
void game::handleInput()
void game::update(float time_step)
{
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(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;
int last = active_States.size() -1;
for( int i = 0;
i <= last;