Computer Science Canada

I could use some assistance...

Author:  zmb19 [ Fri Jan 04, 2008 1:34 am ]
Post subject:  I could use some assistance...

1. why is it flickering so much?
2. how do i stoop this
3. i tried using setscreen ("offscreenonly") -but that removes my button...i tried View.Update command pretty much everywhere possible...
Here is my coding:

%Zackary Bernholtz
%Ms. Dyke
%December 22, 2007
%This program will allow a user to select one of five screensavers and the screensaver will play, with music until the user clicks back on the screen. The user will then need to input a password to get back to their computer and programs.

%Decleration Statement
%These are all the buttons...
var mainMenu, colourful, binary, fish, word, slideShow : int
%this is the speed at which the screensaver will run.
var speed : int
%this is the password which you will need to input to get back to the program after the screensaver.
var password : string
%this will allow you to exit the program by clicking on the Exit button
var finished : boolean := false
%position and size of the screen.
var mainWin := Window.Open ("position:350;40,graphics:640;640")
%help you go to the next screens by clicking on a button
var rangex, rangey, button : int

setscreen ("offscreenonly")

procedure title
cls
locate (1, 30)
put "Screensaver Program"
end title

proc menu
title
end menu

proc intro
title
locate (3, 1)
put "This program will allow you to choose one of five screensavers. You will also need to input a password after you finish using the screensaver. Press the MainMenu button at the bottom of the screen to continue."
drawfillbox (280, 0, 360, 50, black)
locate (39, 37)
put "MainMenu" ..
mousewhere (rangex, rangey, button)
if button = 1 then
if rangex >= 280 and rangex <= 360 and rangey >= 0 and rangey <= 50 then
menu
finished := true
else
locate (10, 10)
put "Please click on the Main Menu button to continue."
end if
end if
end intro

proc goodBye
title
locate (3, 1)
put "Thank you for using a Zackary Bernholtz program!"
end goodBye
loop
intro
exit when finished
end loop
goodBye

Author:  DIIST [ Fri Jan 04, 2008 12:17 pm ]
Post subject:  Re: I could use some assistance...

First, please indent your code. The problem is fixed if you put View.Update after "intro"(in the loop). You ussually put View.Update after your done all the drawing you want to show,

Author:  Gooie [ Sat Jan 05, 2008 1:13 am ]
Post subject:  Re: I could use some assistance...

Turing:
proc goodBye
    Draw.Cls
    title
    locate (3, 1)
    put "Thank you for using a Zackary Bernholtz program!"
end goodBye
loop
    Draw.Cls
    intro
    exit when finished
    View.Update
end loop
goodBye


Replace the pieces required with that, that will stop flickering.


: