% setscreen ("graphics:400;600:sxga")
setscreen ("nocursor")
var fontQ : int := Font.New ("Rockwell:16")
var fontID : int := Font.New ("Rockwell:20")
var fn : string
var intnum : int
var mousex, mousey, mouseb : int
mousewhere (mousex, mousey, mouseb)
function mouseover (x1, y1, x2, y2 : int) : boolean
var mousex, mousey, mouseb : int
mousewhere (mousex, mousey, mouseb)
if mousex >= x1 and mousex <= x2 then
if mousey >= y1 and mousey <= y2 then
result true
end if
end if
result false
end mouseover
procedure button (x1, y1, x2, y2, p1, p2 : int, c : string)
loop
var mousex, mousey, mouseb : int
mousewhere (mousex, mousey, mouseb)
if mouseover (x1, y1, x2, y2) then
drawfillbox (x1, y1, x2, y2, grey)
drawline (x1, y2, x2, y2, 25)
drawline (x1, y1, x1, y2, 25)
drawline (x1, y1, x2, y1, 30)
drawline (x2, y1, x2, y2, 30)
Font.Draw (c, x1 + p1, y1 + p2, fontQ, black)
if mouseb = 1 and mouseover (x1, x2, y1, y2) then
drawfillbox (x1, y1, x2, y2, 104)
drawline (x1, y2, x2, y2, blue)
drawline (x1, y1, x1, y2, blue)
drawline (x1, y1, x2, y1, black)
drawline (x2, y1, x2, y2, black)
Font.Draw (c, x1 + p1, y1 + p2, fontQ, yellow)
delay (100)
cls
exit
end if
else
drawfillbox (x1, y1, x2, y2, grey)
drawline (x1, y2, x2, y2, 30)
drawline (x1, y1, x1, y2, 30)
drawline (x1, y1, x2, y1, 25)
drawline (x2, y1, x2, y2, 25)
Font.Draw (c, x1 + p1 - 1, y1 + p2, fontQ, black)
end if
delay (10)
end loop
end button
process button1 (x1, y1, x2, y2, p1, p2 : int, c : string)
button (x1, y1, x2, y2, p1, p2, c)
cls
Font.Draw ("Enter your name", 80, 580, fontID, black)
Font.Draw ("to start your own file", 60, 560, fontID, black)
locatexy (0, 540)
get fn : *
open : intnum, fn, put
end button1
process buttons2 (x1, y1, x2, y2, p1, p2 : int, c : string)
button (x1, y1, x2, y2, p1, p2, c)
cls
Font.Draw ("Hi Enter your name", 80, 580, fontID, black)
Font.Draw ("to start your own file", 60, 560, fontID, black)
locatexy (0, 540)
get fn : *
end buttons2
fork button1(50, 350, 150, 375, 11, 3, "New Game")
fork buttons2(200, 350, 300, 375, 18, 3, "Continue")
|