Quote: " you don't have a sync command
(this isn't a problem if you haven't used 'sync on' anywhere)
"
Wrong
REM Project: Dark OS
REM Created: 11/28/2005 7:03:42 PM
REM
REM ***** Main Source File *****
REM
set display mode 1024, 768, 32
randomize timer()
set text size 72
center text screen width() / 2, screen height() / 2, "DARK OS"
get image 1, 0, 0, screen width(), screen height()
set text size 12
gosub _Define_Color_Vars
gosub _Define_Vars
do
cls
gosub _call_standard
Message(600, 7, grey, "FPS : " + str$(screen fps()))
`sync
loop
_call_standard:
`slap the desktop image on the screen
paste image 1, 0, 0
gosub _boxes
gosub _draw_toolbar
gosub _start_bar
gosub _easter_eggs
gosub _interface
return
_draw_toolbar:
ink grey, 0
box 0, 0, screen width(), 25
onmouse(filebut) = ColorTextButton(50, 7, "File", blue, darkblue, darkblue, blue)
onmouse(viewbut) = ColorTextButton(100, 7, "View", blue, darkblue, darkblue, blue)
onmouse(exitbut) = ColorTextButton(995, 7, "Exit", blue, darkblue, darkblue, blue)
return
_boxes:
if moveboxes = 1
ink white, 0
for x = 1 to maxbox
box boxx(x), boxy(x), boxx(x) + 50, boxy(x) + boxsize(x)
if boxx(x) > screen width() + 60 then boxx(x) = -60 : boxy(x) = rnd(screen height()) : boxsize(x) = rnd(5) + 5
inc boxx(x), 2
next x
endif
return
_start_bar:
if mousey() > startbary and startbary > minstartbary
dec startbary
else
if startbary < 760 then inc startbary
endif
ink grey, 0
box 200, startbary, 824, screen height()
ink red, 0
center text screen width() / 2, startbary + 20, "Nothing on here sucker"
return
_easter_eggs;
if controlkey() = 1 and keystate(30) = 1
filebox = 0
viewbox = 0
exitbox = 0
do
cls
gosub _call_standard
onok = Prompt("All your base are belong to us")
if onok = 1 and LMB() = 1 then exit
`sync
loop
endif
if keystate(24) = 1 then hold = 50
if keystate(50) = 1 and hold > 0 then hold = 100
if keystate(34) = 1 and hold > 50
filebox = 0
viewbox = 0
exitbox = 0
do
cls
gosub _call_standard
onok = Prompt("More like ZOMFG. ROFL. You found the easter egg")
if onok = 1 and LMB() = 1 then exit
`sync
loop
endif
if hold > 0 then dec hold
return
_interface:
if onmouse(filebut) = 1 and LMB() = 1 and pressed = 0
if filebox = 0
filebox = 1
viewbox = 0
exitbox = 0
else
filebox = 0
endif
pressed = 1
endif
if onmouse(viewbut) = 1 and LMB() = 1 and pressed = 0
if viewbox = 0
viewbox = 1
filebox = 0
exitbox = 0
else
viewbox = 0
endif
pressed = 1
endif
if onmouse(exitbut) = 1 and LMB() = 1 and pressed = 0
if exitbox = 0
exitbox = 1
filebox = 0
viewbox = 0
else
exitbox = 0
endif
pressed = 1
endif
`if filebox = 1 and OnButton(menux1(filebut), menuy1(filebut), menux2(filebut), menuy2(filebut)) = 0 and LMB() = 1 then filebox = 0
`if viewbox = 1 and OnButton(menux1(viewbut), menuy1(viewbut), menux2(viewbut), menuy2(viewbut)) = 0 and LMB() = 1 then viewbox = 0
`if exitbox = 1 and OnButton(menux1(exitbut), menuy1(exitbut), menux2(exitbut), menuy2(exitbut)) = 0 and LMB() = 1 then exitbox = 0
if mouseclick() = 0 then pressed = 0
if filebox = 1
MenuBox(menux1(filebut), menuy1(filebut), menux2(filebut), menuy2(filebut), blue, darkblue, darkblue, blue)
onmouse(newfile) = UglyTextButton(menux1(filebut) + 10, menuy1(filebut) + 20, "New")
onmouse(openfile) = UglyTextButton(menux1(filebut) + 10, menuy1(filebut) + 40, "Open")
onmouse(savefile) = UglyTextButton(menux1(filebut) + 10, menuy1(filebut) + 60, "Save")
if onmouse(newfile) = 1 and LMB() = 1
filebox = 0
do
cls
gosub _call_standard
onok = Prompt("Not in a program")
if onok = 1 and LMB() = 1 then exit
` sync
loop
endif
if onmouse(openfile) = 1 and LMB() = 1
filebox = 0
do
cls
gosub _call_standard
onok = Prompt("Not in a program")
if onok = 1 and LMB() = 1 then exit
` sync
loop
endif
if onmouse(savefile) = 1 and LMB() = 1
filebox = 0
do
cls
gosub _call_standard
onok = Prompt("Not in a program")
if onok = 1 and LMB() = 1 then exit
` sync
loop
endif
endif
if viewbox = 1
MenuBox(menux1(viewbut), menuy1(viewbut), menux2(viewbut), menuy2(viewbut), blue, darkblue, darkblue, blue)
onmouse(boxesview) = UglyTextButton(menux1(viewbut) + 10, menuy1(viewbut) + 20, "Show moving boxes")
if moveboxes = 1
text menux1(viewbut) + 200, menuy1(viewbut) + 20, "X"
endif
if onmouse(boxesview) = 1 and LMB() = 1 and pressed = 0
if moveboxes = 0
moveboxes = 1
else
moveboxes = 0
endif
endif
pressed = 1
endif
if mouseclick() = 0 then pressed = 0
if exitbox = 1
MenuBox(menux1(exitbut), menuy1(exitbut), menux2(exitbut), menuy2(exitbut), blue, darkblue, darkblue, blue)
ink white, 0
text menux1(exitbut) + 20, menuy1(exitbut) + 20, "Are you sure?"
ink darkblue, 0
box menux1(exitbut) + 20, menuy1(exitbut) + 40, menux2(exitbut) - 20, menuy1(exitbut) + 42
onmouse(yesexit) = UglyTextButton(975, 70, "Yes")
if onmouse(yesexit) = 1 and LMB() = 1 then end
onmouse(noexit) = UglyTextButton(975, 90, "No")
if onmouse(noexit) = 1 and LMB() = 1 then exitbox = 0
endif
return
_Define_Color_Vars:
global white as dword
global black as dword
global grey as dword
global darkgrey as dword
global darkblue as dword
global blue as dword
global darkgreen as dword
global green as dword
global darkred as dword
global red as dword
white = rgb(255, 255, 255)
black = rgb(0, 0, 0)
grey = rgb(150, 150, 150)
darkgrey = rgb(50, 50, 50)
darkblue = rgb(0, 0, 100)
blue = rgb(0, 0, 255)
darkgreen = rgb(0, 100, 0)
green = rgb(0, 255, 0)
darkred = rgb(100, 0, 0)
red = rgb(255, 0, 0)
return
_Define_Vars:
maxbox = 30
dim boxx(maxbox)
dim boxy(maxbox)
dim boxsize(maxbox)
moveboxes = 0
for x = 1 to maxbox
boxx(x) = rnd(screen width())
boxy(x) = rnd(screen height())
boxsize(x) = rnd(5) + 5
next x
startbary = 760
minstartbary = 730
`Main Bar
filebut = 1
viewbut = 2
exitbut = 9
`File options
newfile = 10
openfile = 11
savefile = 12
`View options
boxesview = 20
`Exit Options
yesexit = 99
noexit = 100
dim menux1(10)
dim menuy1(10)
dim menux2(10)
dim menuy2(10)
dim onmouse(100)
menux1(filebut) = 35
menuy1(filebut) = 22
menux2(filebut) = menux1(filebut) + 215
menuy2(filebut) = 300
menux1(viewbut) = 85
menuy1(viewbut) = 22
menux2(viewbut) = menux1(viewbut) + 215
menuy2(viewbut) = 300
menux1(exitbut) = 875
menuy1(exitbut) = 22
menux2(exitbut) = 1021
menuy2(exitbut) = 125
return
`The Interface Functions
function UglyTextButton(x, y, text$)
textlength = text width(text$)
textheight = text height(text$)
ink white, 0
if mousex() > x and mousex() < x + textlength and mousey() > y and mousey() < y + textheight
onmouse = 1
else
onmouse = 0
endif
text x, y, text$
endfunction onmouse
function TextButton(x, y, text$)
textlength = text width(text$)
textheight = text height(text$)
ink grey, 0
box (x - (textlength / 2)), (y - (textheight / 2)), (((x + textlength) + 10) - (textlength / 2)), (((y + textheight) + 10) - (textheight / 2))
box ((x - (textlength / 2)) + 3), ((y - (textheight / 2)) + 3), (((x + textlength) + 7) - (textlength / 2)), (((y +textheight) + 7) - (textheight / 2)), blue, darkblue, darkblue, blue
if mousex() > (x - (textlength / 2)) and mousex() < (((x + textlength) + 10) - (textlength / 2)) and mousey() > (y - (textheight / 2)) and mousey() < (((y + textheight) + 10) - (textheight / 2))
onmouse = 1
else
onmouse = 0
endif
ink white, 0
text ((x - (textlength / 2)) + 4), ((y - (textheight / 2)) + 4), text$
endfunction onmouse
function ColorTextButton(x, y, text$, color1, color2, color3, color4)
textlength = text width(text$)
textheight = text height(text$)
ink grey, 0
box (x - (textlength / 2)), (y - (textheight / 2)), (((x + textlength) + 10) - (textlength / 2)), (((y + textheight) + 10) - (textheight / 2))
if mousex() > (x - (textlength / 2)) and mousex() < (((x + textlength) + 10) - (textlength / 2)) and mousey() > (y - (textheight / 2)) and mousey() < (((y + textheight) + 10) - (textheight / 2))
onmouse = 1 : box ((x - (textlength / 2)) + 3), ((y - (textheight / 2)) + 3), (((x + textlength) + 7) - (textlength / 2)), (((y +textheight) + 7) - (textheight / 2)), color2, color1, color4, color3
else
onmouse = 0 : box ((x - (textlength / 2)) + 3), ((y - (textheight / 2)) + 3), (((x + textlength) + 7) - (textlength / 2)), (((y +textheight) + 7) - (textheight / 2)), color1, color2, color3, color4
endif
ink white, 0
text ((x - (textlength / 2)) + 4), ((y - (textheight / 2)) + 4), text$
endfunction onmouse
function Message(x, y, bgcolor, text$)
textlength = text width(text$)
textheight = text height(text$)
ink grey, 0
box (x - (textlength / 2)), (y - (textheight / 2)), (((x + textlength) + 10) - (textlength / 2)), (((y + textheight) + 10) - (textheight / 2))
box ((x - (textlength / 2)) + 3), ((y - (textheight / 2)) + 3), (((x + textlength) + 7) - (textlength / 2)), (((y +textheight) + 7) - (textheight / 2)), bgcolor, bgcolor, bgcolor, bgcolor
ink rgb(255, 255, 255), 0
text ((x - (textlength / 2)) + 4), ((y - (textheight / 2)) + 4), text$
endfunction
function MenuBox(x1, y1, x2, y2, color1, color2, color3, color4)
success = 0
ink grey, 0
box x1, y1, x2, y2
box (x1 + 3), (y1 + 3), (x2 - 3), (y2 - 3), color1, color2, color3, color4
success = 1
endfunction success
function RoundMenuBox(x1, y1, x2, y2, rad, thickness)
success = 0
ink grey, 0
for w = 0 to thickness
for z = 1 to 90
ox = sin(z) * (rad + w)
oy = cos(z) * (rad + w)
nox = sin(z + 1) * (rad + w)
noy = cos(z + 1) * (rad + w)
line x2 + ox, y2 + oy, x2 + nox, y2 + noy
next z
ox = sin(1) * (rad + w)
oy = cos(1) * (rad + w)
line x2 + ox, y2 + oy, x1 + ox, y2 + oy
for z = 90 to 180
ox = sin(z) * (rad + w)
oy = cos(z) * (rad + w)
nox = sin(z + 1) * (rad + w)
noy = cos(z + 1) * (rad + w)
line x2 + ox, y1 + oy, x2 + nox, y1 + noy
next z
ox = sin(90) * (rad + w)
oy = cos(90) * (rad + w)
line x1 - ox, y2 + oy, x1 - ox, y1 + oy
for z = 180 to 270
ox = sin(z) * (rad + w)
oy = cos(z) * (rad + w)
nox = sin(z + 1) * (rad + w)
noy = cos(z + 1) * (rad + w)
line x1 + ox, y1 + oy, x1 + nox, y1 + noy
next z
ox = sin(180) * (rad + w)
oy = cos(180) * (rad + w)
line x1 + ox, y1 + oy, x2 + ox, y1 + oy
for z = 270 to 360
ox = sin(z) * (rad + w)
oy = cos(z) * (rad + w)
nox = sin(z + 1) * (rad + w)
noy = cos(z + 1) * (rad + w)
line x1 + ox, y2 + oy, x1 + nox, y2 + noy
next z
ox = sin(270) * (rad + w)
oy = cos(270) * (rad + w)
line x2 - ox, y1 + oy, x2 - ox, y2 + oy
next w
success = 1
endfunction success
function Prompt(Message$)
ink grey, 0
onOK = 0
minx = (screen width() / 2) - (text width(Message$) / 2) - 50
miny = (screen height() / 2) - text height(Message$)
maxx = (screen width() / 2) + (text width(Message$) / 2) + 50
maxy = (screen height() / 2) + text height(Message$) + 100
box minx, miny, maxx, maxy
box minx + 3, miny + 3, maxx - 3, maxy - 3, blue, darkblue, darkblue, blue
box (screen width() / 2) - 50, maxy - 55, (screen width() / 2) + 50, maxy - 30
box (screen width() / 2) - 47, maxy - 52, (screen width() / 2) + 47, maxy - 33, blue, darkblue, darkblue, blue
ink white, 0
centerx = (minx + maxx) / 2
if OnButton((screen width() / 2) - 50, maxy - 55, (screen width() / 2) + 50, maxy - 30) = 1 then onOK = 1
center text centerx, screen height() / 2, Message$
center text centerx, maxy - 50, "OK"
endfunction onOK
function fillcirc(x, y, rad)
success = 0
for z = 0 to 359
ox = sin(z) * rad
oy = cos(z) * rad
box x + ox, y + oy, (x + ox) + rad, (y + oy) + rad
box (x - rad) + (rad / 2), (y - rad) + (rad / 2), (x + rad), (y + rad)
next z
success = 1
endfunction success
function OnButton(x1, y1, x2, y2)
if mousex() > x1 and mousex() < x2 and mousey() > y1 and mousey() < y2
mouseon = 1
else
mouseon = 0
endif
endfunction mouseon
function ClickOnButton(x1, y1, x2, y2)
if LMB() = 1
if mousex() > x1 and mousex() < x2 and mousey() > y1 and mousey() < y2
mouseon = 1
else
mouseon = 0
endif
endif
endfunction mouseon
function LMB()
leftclick = 0
if mouseclick() = 1 then leftclick = 1
endfunction leftclick
function RNDCol()
col as dword
col = rgb(rnd(255), rnd(255), rnd(255))
endfunction col
function GetRedPoint(x, y)
redcol as dword
redcol = 0
redcol = rgbr(point(x, y))
endfunction redcol
function GetGreenPoint(x, y)
greencol as dword
greencol = 0
greencol = rgbg(point(x, y))
endfunction greencol
function GetbluePoint(x, y)
bluecol as dword
bluecol = 0
bluecol = rgbb(point(x, y))
endfunction bluecol