This is one solution.
http://www.thehavok.scene.org/scene/...initd3ddx9.php
That tutorial proposes this
Code:
while(message != QUIT)
{
if(GetMessageFromQueue())
{
SendMessageToMsgProc();
}
GameLoop();
}
(elsewhere in the code)
HRESULT GameLoop()
{
switch(CurrentPartOfGame)
{
case MainMenu:
RenderMainMenu();
case ConfigMenu:
RenderConfigMenu();
case Exiting:
RenderExitScreen();
case InGame:
RenderGame();
}
return S_OK;
}
But you don't need to cram everything into the handling of one message (it would probably, in fact, be bad in a game to do it in WM_PAINT or something). You should probably make more game oriented handling of things, using peekmessage and processing messages only when you need to and doing your game stuff the rest of the time. Good article: http://www.mvps.org/directx/articles..._game_loop.htm then you can just do what you want.