[plt-scheme] Double buffer (scheme/gui)

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Apr 11 14:47:16 EDT 2009

Oh! I misread the code. You need to create a single bitmap containing
the whole thing and then draw it. Don't draw two bitmaps (that's
what's causing your flicker).


On Sat, Apr 11, 2009 at 12:59 PM, CHAMLY <marc.chamly at gmail.com> wrote:
> Well I already put the 'no-autoclear  to the canvas, my BITMAP-DC-1 (tunnel)
> doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to put the
> 'no-autoclear somewhere else, and see if it works.
> Thank you.
> On Apr 11, 2009, at 7:31 PM, Robby Findler wrote:
>> Probably you want to pass the 'no-autoclear style to the canvas%
>> object when you create it (I may have got the precise name wrong, but
>> it is listed in the docs for the initialization arguments to canvas%).
>> But you also probably want to only recreate the bitmaps when their
>> content changes, not every time the window is refreshed. In other
>> words, all but the last line below should be somewhere else, not in
>> the on-paint method.
>> Robby
>> On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY <marc.chamly at gmail.com> wrote:
>>> HI!
>>> I am programming a game on scheme using #lang scheme/gui, the game is
>>>  made
>>> of:
>>> 1) an object (copter) that when you click moves up, otherwise it falls
>>> down,
>>> and does not move horizontaly.
>>> 2) a tunnel that moves from right to left, giving the impression that the
>>> object is moving forward (moving to the right reaching the end of the
>>> tunnel).
>>> I have a little problem with my double buffer,
>>> I'm using two bitmaps one to draw the copter, and one to draw my tunnel
>>> Here is what i have in the paint-callback of my canvas:
>>>            (send BITMAP-DC-1 clear)              ; i move my tunnel
>>>            (send TUNNEL draw-tunnel1  BITMAP-DC-1  y1)
>>>            (send dc draw-bitmap BITMAP-1  (- x-canvas) 0 'solid))
>>>            (send BITMAP-DC-2 clear)     ; i move my copter
>>>            (send BITMAP-DC-2 draw-bitmap copterUp  0 0 'solid)
>>>            (send dc draw-bitmap BITMAP-2  150 (send COPTER get-y-copter)
>>>  'solid))
>>> The problem is that my copter still flickers, and i don't know why??
>>> (i don't draw my copter in BITMAP-DC-1 because afterwords i also use
>>> other
>>> bitmaps to draw my tunnel)
>>> thanks
>>> Marc
>>>           _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.