r119 - trunk/src
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Jun 18 11:49:04 EDT 2005
Author: jonas
Date: 2005-06-18 11:49:04 -0400 (Sat, 18 Jun 2005)
New Revision: 119
Modified:
trunk/src/common.cpp
trunk/src/gfxeng.cpp
trunk/src/input.cpp
trunk/src/lost_penguins.cpp
trunk/src/menu.cpp
trunk/src/physics.cpp
Log:
use game_mode GAME_MENU
Modified: trunk/src/common.cpp
===================================================================
--- trunk/src/common.cpp 2005-06-18 15:22:43 UTC (rev 118)
+++ trunk/src/common.cpp 2005-06-18 15:49:04 UTC (rev 119)
@@ -11,7 +11,7 @@
Font* font2;
Config config;
Uint8 game_mode=NOTHING;
-Menu* menu;
+Menu* menu=NULL;
string itos(int i) {
std::stringstream s;
Modified: trunk/src/gfxeng.cpp
===================================================================
--- trunk/src/gfxeng.cpp 2005-06-18 15:22:43 UTC (rev 118)
+++ trunk/src/gfxeng.cpp 2005-06-18 15:49:04 UTC (rev 119)
@@ -47,7 +47,7 @@
void GraphicsEngine::draw() {
//Menu
- if (menu) {
+ if (game_mode&GAME_MENU) {
//Assure we have a (correct) menu background
if (!menubg) {
if (game_mode&GAME_PLAY) {
@@ -59,11 +59,10 @@
if (updatetype==UPDATE_ALL) {
if (game_mode&GAME_PLAY) {
setGameMenuBG();
- drawMenu();
} else {
setMenuBG();
- drawMenu();
}
+ drawMenu();
} else if (updatetype==UPDATE_MENU) {
drawMenu();
}
Modified: trunk/src/input.cpp
===================================================================
--- trunk/src/input.cpp 2005-06-18 15:22:43 UTC (rev 118)
+++ trunk/src/input.cpp 2005-06-18 15:49:04 UTC (rev 119)
@@ -28,12 +28,13 @@
}
void InputHandler::update() {
- if (menu) {
+ if (game_mode&GAME_MENU) {
pollMenuEvents();
} else if (game_mode&GAME_PAUSED) {
pollPausedEvents();
+ } else if (game_mode&GAME_PLAY) {
+ pollGameEvents();
} else {
- pollGameEvents();
}
}
Modified: trunk/src/lost_penguins.cpp
===================================================================
--- trunk/src/lost_penguins.cpp 2005-06-18 15:22:43 UTC (rev 118)
+++ trunk/src/lost_penguins.cpp 2005-06-18 15:49:04 UTC (rev 119)
@@ -51,7 +51,6 @@
scenario=new Scenario();
gfxeng->setMenuBG();
- menu=NULL;
setMenu(new StartMenu());
while (true) {
Modified: trunk/src/menu.cpp
===================================================================
--- trunk/src/menu.cpp 2005-06-18 15:22:43 UTC (rev 118)
+++ trunk/src/menu.cpp 2005-06-18 15:49:04 UTC (rev 119)
@@ -9,6 +9,8 @@
if (menu) gfxeng->update(UPDATE_MENU);
else gfxeng->update(UPDATE_ALL);
newmenu->setLast(menu);
+ if (newmenu) game_mode|=GAME_MENU;
+ else game_mode&=~GAME_MENU;
return menu=newmenu;
}
@@ -18,6 +20,8 @@
Menu* tmp=menu->getLast();
delete menu;
if (!tmp) gfxeng->update(UPDATE_ALL);
+ if (tmp) game_mode|=GAME_MENU;
+ else game_mode&=~GAME_MENU;
return menu=tmp;
} else {
gfxeng->update(UPDATE_ALL);
Modified: trunk/src/physics.cpp
===================================================================
--- trunk/src/physics.cpp 2005-06-18 15:22:43 UTC (rev 118)
+++ trunk/src/physics.cpp 2005-06-18 15:49:04 UTC (rev 119)
@@ -22,12 +22,12 @@
}
void PhysicHandler::update() {
- if (menu) {
+ if (game_mode&GAME_MENU) {
reset_time=true;
} else if (game_mode&GAME_PAUSED ) {
reset_time=true;
updatePaused();
- } else {
+ } else if (game_mode&GAME_PLAY) {
if (reset_time) {
Dfps=Dframes=currentfps=dt=0;
minfps=1000;
@@ -38,6 +38,7 @@
reset_time=false;
tcurrent=SDL_GetTicks();
updateGame();
+ } else {
}
}
More information about the lostpenguins-commits
mailing list