Original Post
This problem has been confusing me forever. This is how it goes everytime:
I have a global (game_state or whatever) that keeps track of the state of the game (ie: menu, running, etc...) I then do a check in GameMain() to choose which function to run.
Anywho...
Look at this code below:
(I took a lot of it from LaMothe, if it looks familiar...)
Ok, this is the problem. When the game starts, it runs Seup() fine. The setup simply simply allows the user to select a sprite size (I''m actually writing a simple sprite editor to help me do sprites) by clicking on the size the want. I got that to work. Upon clicking, the AppState becomes 1 (active) and so GameMain should execute. Only, it doesn''t. I am 100% GameMain() never executes.
Shutdown(), however, does run. I did a check to make sure AppState did indeed equal 1 and it does. What''s the problem here? I''m kinda a newbie -- go easy
Thanks in advance,
Peon
while(true)
{
// test if there is a message in queue, if so get it
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
// test if this is a quit
if (msg.message == WM_QUIT)
break;
// translate any accelerator keys
TranslateMessage(&msg);
// send the message to the window proc
DispatchMessage(&msg);
} // end if
//check app state
if (AppState == 0)
Setup();
else
if (AppState == 1)
Game_Main();
} // end while
// closedown game here
Game_Shutdown();
// return to Windows like this
return(msg.wParam);
} // end WinMain |