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

From: CHAMLY (marc.chamly at gmail.com)
Date: Sat Apr 11 13:25:29 EDT 2009


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)



Posted on the users mailing list.