My program is acting kinda funny.. this is part of my code:
Code:
struct BUFFER
{
HDC dcFront; //screen
HDC dcBack; //back buffer
HDC dcBitmap; //never mind about this one for now
(...)
};
Code:
//somewhere in WinMain():
while(!done)
{
if(PeekMessage(...))
(...)
else
{
drawBG(); //displays the background (a bitmap)
ship.move(); //changes ship.pos, which is a POINT
ship.draw(buff); //displays the bitmap of the ship
swapBackBuffer(buff, true); //BitBlt()'s dcBack into dcFront
}
}
If I try running this, it freezes the program. But, if I add "Sleep(1);" after swapBackBuffer() (or any sleep except for 0), it will run ok. Does anybody know why?