while(TRUE){
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE){
// Quit if necessary
}
else{
if (nextFRAME<timeNOW){
// Sprite1.move();
// Screen.clear(RGB(0,0,0));
// Sprite1.draw(Screen.GetSurface());
// Screen.Flip();
nextFRAME=timeNOW+timeBETWEENusually;
}
}
The code above should demonstrate (simplified) how I usually implement a game loop for a DD7 game. (As you can see I'm still a beginner).
The loop above works well when animating sprites.
NOW: I have read that text output must still be done by GDI-Functions. Does this mean I have to send a WM_PAINT message to my Message-Processing CALLBACK function? But that means that the earliest point of time the text appears on the screen will be when the PeekMessage Part is processed. The problem is that the Sprite1.draw() function and the WM_PAINT message would be processed at completely different points of time, and I would have twice as much calls to the Screen.Flip() function, resulting in an annoying loss of time and performance.
(I also heard one should not mix GDI and DirectDrawBlitting Functions in the same program).
How would you solve the problems stated above?



LinkBack URL
About LinkBacks


