General question from a beginner to Windows C++ programming
I have recently started programming windows in C++ using the general GDI and
there is something I cannot figure out about message based programming.
Lets say you are making a game. The game starts with a screen that allows
you to choose 1 player or 2. You would set up a window in WinMain showing
this screen, along with a WndProc that would handle the messaages such as
LBUTTONDOWN. After you chose one player or 2, you would want to clear the
screen and draw the main game display, thereby having a whole new set of
messages for this part of the game only. You wouldn't want to know whether
someone had chosen 1 player or 2 because that screen has already been
established. You now want to know if they are moving, firing, getting hit by
My question is, do you use the same screen (and WndProc) for both of
these screens and simply add a ton of flags in the WndProc to see what point
you are in the game, ie:
Do start screen stuff...}
Do main game stuff...}
Do setting screen stuff...}
Or would you set up a different WndProc for each of the main elements in the
game, having a different WM_SIZE area in each. If this is the case, would you
set it up in WinMain, creating a window for the start screen along with
WndProcStartScreen catering to all of the messages, then destroy this window
when complete and set up another window with another WndProc right on top of
it handling all the new messages for the new part of the game?
Please help, this has been driving me nuts.