Game Development Reference
In-Depth Information
The next thing that happens is you push the modal screen onto the view you found
earlier, and you call a special method that acts as a surrogate Windows message
pump for the modal dialog:
int GameCodeApp::PumpUntilMessage (UINT msgEnd,
WPARAM* pWParam, LPARAM* pLParam)
{
int currentTime = timeGetTime();
MSG msg;
for ( ;; )
{
if ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if ( PeekMessage( &msg, NULL, 0, 0, 0 ) )
{
if ( msg.message != WM_SYSCOMMAND ||
msg.wParam != SC_CLOSE )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// Are we done?
if ( ! IsIconic(GetHwnd()) )
{
FlashWindow( GetHwnd(), false );
break;
}
}
}
else
{
// Update the game views, but nothing else!
// Remember this is a modal screen.
if (m_pGame)
{
int timeNow = timeGetTime();
int deltaMilliseconds = timeNow - currentTime;
for(GameViewList::iterator i=m_pGame->m_gameViews.begin();
i!=m_pGame->m_gameViews.end(); ++i)
{
(*i)->VOnUpdate( deltaMilliseconds );
}
currentTime = timeNow;
DXUTRender3DEnvironment();
Search WWH ::




Custom Search