Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need some help here >.<
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lucky8




PostPosted: Sun Mar 01, 2009 10:14 pm   Post subject: need some help here >.<

for this assignment i got, i made my background in turing and i made my thing to move around with loop, my problem is how to move my thing with clear screen without reprinting my background? it look weird when it prints background everytime, kinda flashy.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Mar 01, 2009 10:31 pm   Post subject: RE:need some help here >.<

look into View.Update
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
A.J




PostPosted: Sun Mar 01, 2009 10:32 pm   Post subject: Re: need some help here >.<

to avoid the 'flashiness', try looking up View.Update in the Turing Walkthrough

EDIT : Sorry Tony...looks like you posted right before I did...
rdrake




PostPosted: Sun Mar 01, 2009 10:32 pm   Post subject: RE:need some help here >.<

You can't draw multiple layers. What you want to do is draw the entire screen before displaying it. Check out View.Set and View.Update.

EDIT: Holy hell, beaten twice.
Euphoracle




PostPosted: Sun Mar 01, 2009 10:57 pm   Post subject: RE:need some help here >.<

There's no way to do this. What you want to do is use "offscreenonly", draw to the backbuffer, and call View.Update when you're done drawing everything for the current frame. Example:

Turing:
setscreen ("offscreenonly")

const baseshift := 150
var shift := baseshift

proc DrawBackground
    drawfillbox (0, 0, maxx, maxy, blue)
end DrawBackground
proc DrawObject (xshift, yshift : int)
    var x := (maxx div 2) + xshift
    var y := (maxy div 2) + yshift
    var r := 50
    drawfilloval (x, y, r, r, red)
end DrawObject

var speed := 1
var deg := 0
var speed2 := 5
var deg2 := 0
var xs, ys : int

loop
    deg2 += speed2
    shift := round(cosd(deg2) * baseshift)
    deg += speed
    xs := round (cosd (deg) * shift)
    ys := round (sind (deg) * shift)
    DrawBackground
    DrawObject(xs, ys)
    View.Update ()
    Time.DelaySinceLast(20)
end loop


Look 'mah, no flickering!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: