I am looking at the code in my WinMain, I know what it does,
I just don't know the exact particulars and what regulates it.
Question 1:Code:while(TRUE) { if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { //Process the message if(msg.message==WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else { //Make sure the game engine isn't sleeping if(!GameEngine::GetEngine()->GetSleep()) { //Check the tick count to see if a game cycle has elapsed iTickCount=GetTickCount(); if(iTickCount>iTickTrigger) { iTickTrigger=iTickCount + GameEngine::GetEngine()->GetFrameDelay(); GameCycle(); } } } }
In the line if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) it
is passing the message to be Translated and Dispatched if it fails to Peek, but how would it know what the messag is if it could not peek at it?
So I am assuming that it is trying to peek, if it can then great perform a GameCycle, otherwise check to see it is a quit message, then translate it.
Question 2:
How often is this cycle of peeking messages ran through? Is it based on CPU Cycles...?
Just seeking to understand everything better...
Thanks for any responses.