langham@nixdorf.de (Langham) (01/28/91)
Hi !! I would like to move the icon of a ball around the client area of a window. Using the WM_TIMER event I can compute the new position of the icon, do an InvalidateRect() of the client area and send a WM_PAINT message to the window to get the DrawIcon() done. Ok - works fine .... The only trouble is that the icon tends to flash, so the movement isnt smooth. I know that I should probably only InvalidateRect() the part of the client area that will need redrawing, but.. Any other ideas on how to get this done *NEATLY* ? So all you animation freaks and game writers - ideas please ! Matthew Langham -- ++ Matthew Langham !USA : langham.pad@sni.de.com ++ ++ --------------- USA : langham.pad@nixdorf.com ++ ++ : SNI AG, Dept. DS FI ASDC, Pontanusstr. 55 ++ ++ --------------- D-4790 Paderborn ((Ger)-5251-14-6345) ++
garyc@dbase.A-T.COM (Gary Carter) (02/03/91)
Rather than using invalidate rect, you need to erase the image of the icon at the old position and then redraw it at the new position. In addition, if the bounding rectangles for the old and new positions overlap, you need to do this in a buffer first, then BitBlt the buffer to the screen just once. Petzold elaborates upon this subject in his Checkers article in March 1990 Microsoft Systems Journal, under the subheading, "Moving the pieces without flicker". Hope this helps.
jimad@microsoft.UUCP (Jim ADCOCK) (02/05/91)
In article <langham.665074791@peun19> langham@nixdorf.de (Langham) writes: |Hi !! | |I would like to move the icon of a ball around the client area of |a window. .... |The only trouble is that the icon tends to flash, so the movement isnt |smooth. I know that I should probably only InvalidateRect() the part |of the client area that will need redrawing, but.. Have you seen Petzold's discussion of a similar game issue in PM, discussed in the March 1990 "Microsoft Systems Journal" ?