SetErrorMode(2)
SetOrientationAllowed(1,1,1,1)
SetScissor(0,0,0,0)
width=getmaxdevicewidth()
height=getmaxdeviceheight()
setvirtualresolution(width,height)
UseNewDefaultFonts(0)
x1=0:x2=width:y1=1:y2=1
red=128:green=128:blue=255
createtext(1,"file")
settextsize(1,24)
settextcolor(1,255,255,255,255)
settextvisible(1,1)
settextdepth(1,0)
do
for i=1 to 40
drawline(x1,y1,x2,y2,makecolor(red,green,blue),makecolor(red,green,blue))
inc y1,1:inc y2,1
dec red,3:dec blue,3
next i
Render() // -added to make text appear above the gradient filled box
//reset
y1=1:y2=1:red=128:green=128:blue=255
settextposition(1,30,30)
sync()
sleep(20)
loop
Adding the call to render forces the lines to be drawn and so the text appears above it.
Also...the drawbox function will do what you want more quickly and simply
SetErrorMode(2)
SetOrientationAllowed(1,1,1,1)
SetScissor(0,0,0,0)
width=getmaxdevicewidth()
height=getmaxdeviceheight()
setvirtualresolution(width,height)
UseNewDefaultFonts(0)
x1=0:x2=width:y1=1:y2=1
red=128:green=128:blue=255
createtext(1,"file")
settextsize(1,24)
settextcolor(1,255,255,255,255)
settextvisible(1,1)
settextdepth(1,0)
settextposition(1,30,30)
col1 = makecolor(red,green,blue) // start color
col2 = makecolor(red-120,green-120,blue) // end color
do
DrawBox(x1,1,x2,41,col1,col1,col2,col2,1)
Render() // -added to make text appear above the gradient filled box
sync()
sleep(20)
loop
I wouldnt bother sleeping in the main loop either....let SetVSync() or SetSyncRate() so that a frame rate is maintained and automatic sleeping occurs