flickerless menu
Author |
Message |
musicman
|
Posted: Thu Jun 03, 2010 9:59 am Post subject: flickerless menu |
|
|
this is a menu for a collection of games i am making, but i would like to have this menu without the flickering. i have tried to use the ("offscreenonly") syntax because that is whats i was told would work. is there any other way to do this?
Turing: |
drawfillbox (50, 50, 100, 100, 7)
var x, y : int
var a : string (1)
x := maxx div 2
y := maxy div 2
var chars : array char of boolean
loop
colorback (7)
drawbox (0, 0, maxx, maxy, 10)
drawbox (0, 0, 195, 195, 10)
drawbox (0, maxy, 195, maxy - 195, 10)
drawbox (maxx, 0, maxx- 195, 195, 10)
drawbox (maxx, maxy, maxx - 195, maxy - 195, 10)
drawbox (200, 0, maxx - 200, 100, 10)
drawbox (200, maxy - 100, maxx - 200, maxy, 10)
Input.KeyDown (chars )
if x > 5 and x < 635 and y > 5 and y < 395 then
if chars (KEY_UP_ARROW) then
y := y + 5
end if
if chars (KEY_RIGHT_ARROW) then
x := x + 5
end if
if chars (KEY_LEFT_ARROW) then
x := x - 5
end if
if chars (KEY_DOWN_ARROW) then
y := y - 5
end if
elsif x < 6 or x > 636 or y < 6 or y > 396 then
x := maxx div 2
y := maxy div 2
end if
drawoval (x, y, 4, 4, 10)
delay (10)
cls
color (10)
put x, " " ..
put y
end loop
|
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
SNIPERDUDE

|
Posted: Thu Jun 03, 2010 10:13 am Post subject: Re: flickerless menu |
|
|
I've made a couple updates and pointed them out. Call them mini-lessons.
Turing: | setscreen ("graphics:639;399,nobuttonbar,offscreenonly")
% ^ Setting it to graphics, screen size 639x399, hiding the button bar at the top of the run window, and the needed offscreenonly for drawing.
drawfillbox (50, 50, 100, 100, 7)
colorback (7) %<---- (Same as below)
color (10) %<---- Because this only needs to be called once (unless you are changing the colour), I moved it before the loop
var x, y : int
var a : string (1)
x := maxx div 2
y := maxy div 2
var chars : array char of boolean
loop
cls %<---- cls should be at the top of the loop, before you draw anything to the screen (it will wipe the screen clear)
drawbox (0, 0, maxx, maxy, 10)
drawbox (0, 0, 195, 195, 10)
drawbox (0, maxy, 195, maxy - 195, 10)
drawbox (maxx, 0, maxx - 195, 195, 10)
drawbox (maxx, maxy, maxx - 195, maxy - 195, 10)
drawbox (200, 0, maxx - 200, 100, 10)
drawbox (200, maxy - 100, maxx - 200, maxy, 10)
Input.KeyDown (chars )
if x > 5 and x < 635 and y > 5 and y < 395 then
if chars (KEY_UP_ARROW) then
y := y + 5
end if
if chars (KEY_RIGHT_ARROW) then
x := x + 5
end if
if chars (KEY_LEFT_ARROW) then
x := x - 5
end if
if chars (KEY_DOWN_ARROW) then
y := y - 5
end if
elsif x < 6 or x > 636 or y < 6 or y > 396 then
x := maxx div 2
y := maxy div 2
end if
drawoval (x, y, 4, 4, 10)
delay (10)
put x, " " ..
put y
View.Update %<---- View.Update goes at the end of the loop, after you have drawn everything
end loop
|
Hope that helps you. |
|
|
|
|
 |
musicman
|
Posted: Fri Jun 04, 2010 9:08 am Post subject: Re: flickerless menu |
|
|
thanks so much. that really helps |
|
|
|
|
 |
|
|