Computer Science Canada

Created the DVD "bounce" screen in Turing

Author:  MrMac [ Tue Mar 10, 2015 5:03 pm ]
Post subject:  Created the DVD "bounce" screen in Turing

If you've ever seen the scene in The Office where they wait for the DVD logo to bounce in the corner of the screen, or looked at a TV with the output set to DVD, with no DVD in the player, you've seen this before. But now, you can enjoy it from the comfort of your own home, using TURING!

Warning! Flickers a lot. If you can, explain how to remove the flickering.

Author:  Zren [ Tue Mar 10, 2015 5:29 pm ]
Post subject:  RE:Created the DVD "bounce" screen in Turing

Quote:
Warning! Flickers a lot. If you can, explain how to remove the flickering.


That's because, by default, draw operations are drawn directly to the screen. The screen refreshes 60 times per second, and it can refresh at any point during your code. The "flicker" is because it might be updating the screen when you haven't completely drawn everything in the current iteration of your loop. Eg: it updates right after you've cleared the screen, but haven't drawn the logo.

The fix this, we need to manually update the screen.

Turing:

View.Set ("offscreenonly") % Turn on drawing to memory, instead of right to the screen.
% Initialize
% ...
loop
    % Update / Logic
    % ...

    % Draw Frame
    cls
    Draw.FillBox (0, 0, maxx, maxy, black) % Draw in memory
    View.Update () % Display picture drawn in memory onto the screen.

    Time.DelaySinceLast (1000 div 60) % ~60 FPS
end loop

Author:  MrMac [ Tue Mar 10, 2015 5:45 pm ]
Post subject:  Re: Created the DVD "bounce" screen in Turing

Actually figured it out.

%Pic.Draw (DVDlogo, x, y, picXor)
%drawfillbox(x,y,x+320,y+198,black)

These two lines were redundant, and I fixed the flickering.


: