求助:各位大哥,请帮我看看下面这段小程序,谢谢!
bool CALL HGE_Impl::System_Start()
{
MSG msg;
POINT pt;
RECT rc;
if(!hwnd)
{
_PostError("System_Start: System_Initiate wasn't called");
return false;
}
if(!procFrameFunc) {
_PostError("System_Start: No frame function defined");
return false;
}
bActive=true;
for(;;)
{
if(!hwndParent) //这是父窗口,是吗?
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT) break;
// TranslateMessage(&msg);
DispatchMessage(&msg);
continue;
}
}
GetCursorPos(&pt);
GetClientRect(hwnd, &rc);
MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
if(bCaptured || (PtInRect(&rc, pt) && WindowFromPoint(pt)==hwnd)) bMouseOver=true;
else bMouseOver=false;
if(bActive || bDontSuspend) {
do { dt=timeGetTime() - t0; } while(dt < 1);
if(dt >= nFixedDelta)
{
fDeltaTime=dt/1000.0f;
if(fDeltaTime > 0.2f)
{
if(nFixedDelta) fDeltaTime=nFixedDelta/1000.0f;
else fDeltaTime=0.01f;
}
fTime+=fDeltaTime;
t0=timeGetTime();
if(t0-t0fps < 1000) cfps++;
else {nFPS=cfps; cfps=0; t0fps=t0;}
if(procFrameFunc()) break;
if(procRenderFunc) procRenderFunc();
if(hwndParent) break;
_ClearQueue();
if(!bWindowed && nHGEFPS==HGEFPS_VSYNC) Sleep(1);
}
else { if(nFixedDelta && dt+3 < nFixedDelta) Sleep(1); }
}
else Sleep(1);
}
_ClearQueue();
bActive=false;
return true;
}
求助:
这一段程序,我有几个地方看不懂,请各位大哥帮忙
问题1:
if(!hwndParent) //这是父窗口,是吗?
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT) break;
// TranslateMessage(&msg);
DispatchMessage(&msg);
continue;
}
这一段程序什么意思啊?
问题2:
什么条件才能跳出 for 循环?
问题3:
MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
这句话什么意思?
问题4:
if(bCaptured || (PtInRect(&rc, pt) && WindowFromPoint(pt)==hwnd)) bMouseOver=true;
else bMouseOver=false;
这句话是什么意思?
谢谢!