[ddraw] 为什么只有鼠标移动的时候才会更新所渲染的图像?
void CRender::Render()
{
if (!m_bInit)return;
int posX = 0;
int posY = 0;
POINT point ={ 0, 0 };
::ClientToScreen(m_hWnd, &point);
posX+=point.x, posY+=point.y;
static int curFrame = 0;
static DWORD lastTime = GetTickCount();
if (m_SurfaceList[curFrame].m_pSurface != NULL)
{
RECT srcRect = { 0, 0, m_SurfaceList[curFrame].m_Width, m_SurfaceList[curFrame].m_Height };
RECT dstRect = { posX, posY, posX+m_SurfaceList[curFrame].m_Width, posY+m_SurfaceList[curFrame].m_Height };
m_pDDPrimarySurface->Blt(&dstRect, m_SurfaceList[curFrame].m_pSurface, &srcRect, DDBLTFAST_NOCOLORKEY|DDBLT_WAIT, NULL);
}
DWORD curTime = GetTickCount();
if (curTime-lastTime >= 60)
{
if (++curFrame >= _SURFACE_COUNT)
{
curFrame = 0;
}
}
}