[plt-scheme] Re: MrEd - Animated canvas
On Mar 24, 2007, at 10:49 AM, Laurent wrote:
> - My second question :
> The timer calls refresh who call paint-callback. In this method, i
> draw the beater, the bricks and the balls of my wall-breaker.
> However as my beater jerks at the time of displacement I wanted to use
> a thread. But if I use a thread the beater flick.
> I don't see why ?
I don't know why you are using a thread, but I can guess that it
makes the synchronization of the drawing uncertain. I.e., what
happens if the thread is still running when paint-callback starts
draw-bitmap?
rac
>
>> (define canvas_2
>> (new wb-canvas% (parent vpanel_2)
>> (min-width 630)
>> (style '(border no-autoclear))
>> (paint-callback
>> (lambda (canvas dc)
>> (reset-offscreen! canvas_2)
>> ;; On efface le buffer
>> (send OFFSCREEN-DC clear)
>> ;; On dessine les differents elements dans le buffer
>> (send OFFSCREEN-DC draw-bitmap bg 0 0)
>> (thread (lambda ()
>> (draw-batte OFFSCREEN-DC)))
>> (draw-bricks OFFSCREEN-DC)
>> (draw-balls OFFSCREEN-DC)
>> ;; On copie l'image a l'écran
>> (send dc draw-bitmap OFFSCREEN-BM 0 0)))))
>
> Thanks,
> Laurent
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme