[plt-scheme] Flicker-free redrawing of canvas

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Tue May 31 08:44:19 EDT 2005

Hi all,

I'm implementing Pacman using MrEd, so I can try out some
AI ideas on top of it.  It works, but the screen flickers
horribly.  Clearly this yields unacceptable working
conditions for my AI.  I've tried using double buffering --
drawing to an off screen bitmap% and then dumping that
bitmap to the canvas's dc<%> using the draw-bitmap method. 
It still flickers.  This code is thus:

     (define/override (on-paint)
        (let ((dc (send this get-dc)))
          ;; draw everything on the bitmap, then bulk copy
          ;; the bitmap to the current display.  Basically
          ;; double-buffering.
          (send bitmap-dc clear)
          (draw-map bitmap-dc)
          (draw-pacman pacman bitmap-dc)
          (send dc draw-bitmap bitmap 0 0 'solid
background-colour #f)
          ;(send dc clear)
          ;(draw-pacman pacman dc)
          ))

Is there any way I can I avoid this problem?  

Thanks,
Noel

Email: noelwelsh <at> yahoo <dot> com
AIM: noelhwelsh

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Posted on the users mailing list.