
-----------------------------------
ddndd
Sat Jan 09, 2010 10:18 pm

drawing two ovals at the same time
-----------------------------------
hi
im trying to make 2 moving ovals, so far i created them and they are moving but the problem is that they are flashing too much, cuz i used a delay and drew them again in white 

code :
var x,y,xx,yy:int
x := maxx div 2 
xx := maxx div 2 + 30
y := 100
loop
y += 1
drawfilloval (x,y,10,10,black)
delay (10)
drawfilloval (x,y,10,10,white)
drawfilloval (xx,y,10,10,black)
delay (10)
drawfilloval (xx,y,10,10,white)
end loop

i use turing 4.1 
any ideas ??

-----------------------------------
TheGuardian001
Sat Jan 09, 2010 10:36 pm

Re: drawing two ovals at the same time
-----------------------------------
This is where View.Update and offscreenonly comes in handy. It basically combines all of the drawing you do into a single drawing, which is only shown on screen when View.Update is called.


View.Set("offscreenonly") %off screen drawing mode
%all drawing is now drawn off screen until View.Update
%is called.

loop
    DRAW_STUFF %offscreen

    View.Update %copy everything that was drawn offscreen and
    %put it onscreen

    cls %clear the offscreen image. Does not affect onscreen image until next View.Update.
end loop


Another problem you may run into is that you don't appear to be drawing in the correct order. In your program the flow is:
once inside of a loop. The whole point of using View.Update is to reduce flickering by drawing an entire scene in one motion. If you call it more than once in a single loop, you are defeating the purpose of using it in the first place.

-----------------------------------
ddndd
Sun Jan 10, 2010 11:05 am

Re: drawing two ovals at the same time
-----------------------------------
ohh so that is what view. update is for...
thnx :)
