Windows GDI+ help

Started by
1 comment, last by klayAlloy 17 years, 7 months ago
I can't get the flicker out of my program. All the project is right now is a side scrolling starfield (250 pixels) and a half dozen circles. I've been trying everything to get the flicker to go away. I'm using C++ and the program is set up so that I render a bitmap backbuffer when the WM_PAINT message is sent. It simply calls BitBlt() using the window dc as the destination and my buffer as the source. In my update function (which gets called each frame), I clear out the stars and the circles, update the stars, then I call a render function which renders everything to the buffer. Right after that function call I call InvalidateRect(). I think that that is where my problem is. Could anybody please help me it. It would be very much appreciated. Thank you.
Advertisement
So, you're rendering everything into a buffer, which you then blit into the window? That should work; the only thing I can think of is if you're not passing FALSE as the bErase parameter to InvalidateRect(). The default parameter value of bErase is TRUE, which means the invalidated area will be erased before redrawing. If you are trying to double-buffer your window, you do not want this - you want to redraw without erasing. For example:

// In Win32, make sure you call InvalidateRect like this:InvalidateRect(hwnd, myRect, FALSE);// Or like this if you're using MFCmyWnd->InvalidateRect(myRect, FALSE);
Thank you. I'll go ahead and try it and see if it helps.

This topic is closed to new replies.

Advertisement