Computer Science Canada

Turing Help with flashing program

Author:  mayaramamurthy [ Wed Feb 08, 2012 8:46 pm ]
Post subject:  Turing Help with flashing program

How would I get my turing program to stop flashing? I have used View.Set ("offscreenonly") as well as View.Update and View.UpdateArea, but still it keeps flashing, what can I do?

Author:  Raknarg [ Wed Feb 08, 2012 9:38 pm ]
Post subject:  RE:Turing Help with flashing program

You're using View.UpdateArea more than once. You should only use it more than once in the same loop if there's a good reason for it. In this case, there is not.

Author:  TerranceN [ Wed Feb 08, 2012 11:06 pm ]
Post subject:  Re: Turing Help with flashing program

Did you not understand my post from the other thread you made?

I opened your code, and on the second line you still have

Turing:
View.Set ("offscreen only")


Which should be

Turing:
View.Set ("offscreenonly")


Note that there isn't a space in the correct version.

As for the sun and moon, your code:
Turing:
        Draw.FillOval (80, y, 65, 65, 43)
        delay (100)
        Draw.FillOval (80, y, 65, 65, 17)
        y := y - 10
        View.UpdateArea (0, 0, maxx, maxy)


Is of the form:
    -Draw sun to the off-screen buffer
    -Delay 100 milliseconds
    -Draw a black oval over the sun on the off-screen buffer, effectively removing it
    -Move the sun coordinate down 10 pixels
    -Draw the off-screen buffer to the screen


If you rearranged those, it would make more sense.

This pattern is found throughout your code, and a simple re-ordering fixes pretty much all of your flickering problems (at least anything I saw). Just remember: nothing gets drawn to the screen until View.Update() or View.UpdateArea() are called.


: