I am working on a Windows game and I have this:
bool game_cont;
LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_QUIT: case WM_CLOSE: case WM_DESTROY: game_cont = false; break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
int WINAPI WinMain()
{
while(game_cont)
{
if(!GameRun()) game_cont = false;
}
return 0;
}
and I am wondering if there is a better way to do this (ignoring the timers & c. right now) than having a game_contglobal one. In short, I need to be able to get out WinMainof WinProc, so that if the user clicks to close the game, otherwise the game than in the game menu, the program will not work in memory. (As it was when I tested it without instructions game_cont..in WinProc.
Oh, and on the side, a note GameRunis basically a bool that returns false when the game ends, and true otherwise.
user98188