View Single Post
Old Dec 3rd, 2007, 1:12 AM   #4
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,034
Rep Power: 5 lectricpharaoh will become famous soon enough
Re: InvalidateRect???

Another thing besides double buffering is proper use of InvalidateRect(). The purpose of this function is to invalidate (ie mark as not up-to-date) a rectangle within your window. As such, if you pass the entire window (or more precisely, the entire client area), you will get more flicker than if you invalidate the smallest region possible.

With something like your game, it should only be updating a small region (about 1/16th of the client area) with each move, and this will probably lead to less flicker. Even if you get the flicker issue solved with double buffering, you should do this; it doesn't make sense to blit sixteen times the pixels you need to.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote