Original Post
I'm almost finished with the 2D level editor I'm working on, whihc I've built in win32, but I've hit a snag. The screen flickers so much when I continueally update the screen, I can barely see what's going on. I looked up some double buffering tuts and checked some old threads posted here on gamedev, but I can't seem to get it working correctly. I essentionally am drawing like this: //Not all the drawing code, but the rest is reduntant
HBITMAP hbmOld;
HBITMAP Bitmap;
hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
hbmOld = (HBITMAP)SelectObject(hdcMem, Bitmap);
BitBlt(hdc, X, Y, 32, 32, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
How can I double buffer it? My attempts leave me with a blank screen. [smile] I think I understand the concept, but I don't get exactly how it's done. Is my buffer supposed to be a HBITMAP or a HDC? How do I 'flip' the buffer to the front? I would much apreciate a code snippet or tutorial so I can see it in action, or a detailed enough explantion for one as thick as me to understand. =) Many thanks,