I have an animated-canvas class on PLaneT that does the double-buffering automatically - I'm sure there are other similar solutions out there too (e.g., I think frtime has some similar classes).<br><br>Doug<br><br><div class="gmail_quote">
On Sat, Apr 11, 2009 at 1:27 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Nevertheless, double buffering means that you have to have the entire<br>
thing in a single buffer. Otherwise you'll draw the tunnel with no<br>
copter and then draw the copter on top, which leads to flicker.<br>
<br>
I don't know what the rest of your code does, but perhaps you don't<br>
really need those two bitmaps at all.<br>
<br>
But if you do, then you'll need a third bitmap.<br>
<font color="#888888"><br>
Robby<br>
</font><div><div></div><div class="h5"><br>
On Sat, Apr 11, 2009 at 2:22 PM, CHAMLY <<a href="mailto:marc.chamly@gmail.com">marc.chamly@gmail.com</a>> wrote:<br>
> Yes, But I have 2 bitmaps, because both of my objects have to move<br>
> independently, the tunnel has to be able to move to the left, without moving<br>
> the Copter, and the Copter has to move Up and Down without moving the<br>
> tunnel...<br>
><br>
> Marc<br>
><br>
><br>
><br>
> On Apr 11, 2009, at 8:47 PM, Robby Findler wrote:<br>
><br>
>> Oh! I misread the code. You need to create a single bitmap containing<br>
>> the whole thing and then draw it. Don't draw two bitmaps (that's<br>
>> what's causing your flicker).<br>
>><br>
>> Robby<br>
>><br>
>> On Sat, Apr 11, 2009 at 12:59 PM, CHAMLY <<a href="mailto:marc.chamly@gmail.com">marc.chamly@gmail.com</a>> wrote:<br>
>>><br>
>>> Well I already put the 'no-autoclear to the canvas, my BITMAP-DC-1<br>
>>> (tunnel)<br>
>>> doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to put<br>
>>> the<br>
>>> 'no-autoclear somewhere else, and see if it works.<br>
>>><br>
>>> Thank you.<br>
>>><br>
>>> On Apr 11, 2009, at 7:31 PM, Robby Findler wrote:<br>
>>><br>
>>>> Probably you want to pass the 'no-autoclear style to the canvas%<br>
>>>> object when you create it (I may have got the precise name wrong, but<br>
>>>> it is listed in the docs for the initialization arguments to canvas%).<br>
>>>><br>
>>>> But you also probably want to only recreate the bitmaps when their<br>
>>>> content changes, not every time the window is refreshed. In other<br>
>>>> words, all but the last line below should be somewhere else, not in<br>
>>>> the on-paint method.<br>
>>>><br>
>>>> Robby<br>
>>>><br>
>>>> On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY <<a href="mailto:marc.chamly@gmail.com">marc.chamly@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> HI!<br>
>>>>><br>
>>>>> I am programming a game on scheme using #lang scheme/gui, the game is<br>
>>>>> made<br>
>>>>> of:<br>
>>>>> 1) an object (copter) that when you click moves up, otherwise it falls<br>
>>>>> down,<br>
>>>>> and does not move horizontaly.<br>
>>>>> 2) a tunnel that moves from right to left, giving the impression that<br>
>>>>> the<br>
>>>>> object is moving forward (moving to the right reaching the end of the<br>
>>>>> tunnel).<br>
>>>>><br>
>>>>><br>
>>>>> I have a little problem with my double buffer,<br>
>>>>> I'm using two bitmaps one to draw the copter, and one to draw my tunnel<br>
>>>>><br>
>>>>> Here is what i have in the paint-callback of my canvas:<br>
>>>>><br>
>>>>> (send BITMAP-DC-1 clear) ; i move my tunnel<br>
>>>>> (send TUNNEL draw-tunnel1 BITMAP-DC-1 y1)<br>
>>>>> (send dc draw-bitmap BITMAP-1 (- x-canvas) 0 'solid))<br>
>>>>><br>
>>>>><br>
>>>>> (send BITMAP-DC-2 clear) ; i move my copter<br>
>>>>> (send BITMAP-DC-2 draw-bitmap copterUp 0 0 'solid)<br>
>>>>><br>
>>>>> (send dc draw-bitmap BITMAP-2 150 (send COPTER get-y-copter)<br>
>>>>> 'solid))<br>
>>>>><br>
>>>>> The problem is that my copter still flickers, and i don't know why??<br>
>>>>> (i don't draw my copter in BITMAP-DC-1 because afterwords i also use<br>
>>>>> other<br>
>>>>> bitmaps to draw my tunnel)<br>
>>>>><br>
>>>>> thanks<br>
>>>>><br>
>>>>><br>
>>>>> Marc<br>
>>>>> _________________________________________________<br>
>>>>> For list-related administrative tasks:<br>
>>>>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
>>>>><br>
>>><br>
>>><br>
><br>
><br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</div></div></blockquote></div><br>