REM Ashingda's Fake OS
set display mode 640,480,32
sync on
sync rate 80
create bitmap 1,640,480
 
 
REM Main Loop
do
	if State = 0 then gosub State0
	if State = 1 then gosub State1
	if State = 2 then gosub State2
	copy bitmap 1,0
	sync
loop
 
State0:
	REM Loading OS Screen
	hide mouse
	set text size 100
	ink rgb(255,255,255),0
	center text 320,0,"Ashingda"
	set text size 99
	ink rgb(155,155,155),0
	center text 320,1,"Ashingda"
	set text size 200
	ink rgb(150,200,255),0
	center text 320,100,"OS"
	set text size 195
	ink rgb(100,150,205),0
	center text 320,105,"OS"
	for lpx = 1 to 12
		ink rgb(c+lpx*20,c+lpx*20,c+lpx*20),0
		box lpx*48-12,440,lpx*48+24,440+24
	next lpx
	c = c - 4
	if c < 0 then c = c + 255 : exitC = exitC + 1
	if exitC > 4 then State = 1 : exitC = 0 : c = 0 : set text size 10
Return
 
State1:
	REM Load Variables
	BGC = rgb(150,200,255)
 
	dim iconDat(10,3)	
	dim iconName$(10)
 
 
	if file exist("Desktop.dat") = 1 then delete file "Desktop.dat"
 
	open to write 1,"Desktop.dat"
		write string 1, "100.100.001.Computer"
		write string 1, "100.150.002.Trash Bin"
		write string 1, "100.200.003.Calculator"
		write string 1, "100.250.004.Text Pad"
	close file 1
 
 
	DeskC = 0
	open to read 1, "Desktop.dat"
		repeat
			DeskC = DeskC + 1
			read string 1, g$
			iconDat(DeskC,0) = val(left$(g$,3))
			iconDat(DeskC,1) = val(right$(left$(g$,7),3))
			iconDat(DeskC,2) = val(right$(left$(g$,11),3))
			iconName$(DeskC) = right$(g$,len(g$)-12)
		until file end(1) = 1
	close file 1
 
	show mouse
	State = 2
return
 
State2:
	REM Desktop
	cls BGC
	MenuBox(1,460,638,19,205,205,205,"",1)
	MenuBox(3,462,40,15,205,205,205,"Start",1)
 
	time$ = get time$()
	hour = val(left$(time$,2))
	min = val(right$(left$(time$,5),2))
	sec = val(right$(time$,2))
	if hour > 12 then hour = hour - 12
	time$ = right$(" "+str$(hour),2)+":"+right$("0"+str$(min),2)+":"+right$("0"+str$(sec),2)
 
	MenuBox(577,462,60,15,205,205,205,time$,2)
 
	for lp = 1 to DeskC-1
		Icon(iconDat(lp,0),iconDat(lp,1),iconDat(lp,2))
	next lp
return
 
 
 
REM \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
REM ------------------------------------------------------------------------
REM Functions //////////////////////////////////////////////////////////////
 
Function Icon(x,y,ID)
	MenuBox(x,y,21,21,205,235,255,"",1)
 
	If ID = 1
		c1 = rgb(200,200,200)
		c2 = rgb(255,255,255)
		ink 0,0:box x+3,y+2,x+17,y+17
		ink c1,0:box x+4,y+3,x+16,y+16
		ink 0,0:Box x+5,y+4,x+15,y+12
		ink c2,0:Box x+6,y+5,x+10,y+9
		ink 0,0:Box x+7,y+6,x+15,y+12
		ink 0,0:Box x+14,y+14,x+15,y+15
	endif
 
 
	If ID = 2
		c1 = rgb(200,200,200)
		c2 = rgb(255,255,255)
		ink 0,0:box x+5,y+2,x+15,y+17
		ink c1,0:box x+6,y+3,x+14,y+16
		ink 0,0:box x+4,y+2,x+16,y+4
		ink c1,0:box x+5,y+3,x+15,y+3
	endif
 
	If ID = 3
		c1 = rgb(200,200,200)
		ink 0,0:box x+5,y+2,x+15,y+17
		ink c1,0:box x+6,y+3,x+14,y+16
		ink 0,0:lBox(x+7,y+4,6,2)
		for lpy = 0 to 4 step 2
		for lpx = 0 to 4 step 2
			ink 0,0:lBox(x+7+lpx,y+8+lpy,2,2)
		next lpx
		next lpy
	endif
 
	If ID = 4
		if CheckArea(x,y,21,21) = 1
		endif
		c1 = rgb(200,200,200)
		c2 = rgb(255,255,255)
		ink 0,0:box x+3,y+2,x+17,y+17
		ink c2,0:box x+4,y+3,x+16,y+16
		ink 0,0:lbox(x+6,y+2,11,15)
		ink 0,0:box x+8,y+5,x+15,y+5
		ink 0,0:box x+8,y+7,x+15,y+7
		ink 0,0:box x+8,y+9,x+15,y+9
		ink 0,0:box x+8,y+11,x+15,y+11
		ink 0,0:box x+8,y+13,x+15,y+13
	endif
 
 
	ink 0,0
	center text x+10,y+22,IconName$(ID)
EndFunction
 
Function Calculator()
	REM 
 
EndFunction
 
Function CheckArea(x,y,l,h)
	retval = 0
	mx = mousex()
	my = mousey()
	mc = mouseclick()
	if mx > x & mx < x+l & my > y & my < y+h then retval = 1
EndFunction retval
 
Function lBox(x,y,l,h)
	box x,y,x+l,y
	box x,y,x,y+h
	box x,y+h,x+l,y+h
	box x+l,y,x+l,y+h
EndFunction
 
Function MenuBox(x,y,l,h,r,g,b,t$,mode)
	REM X,Y,Length,Height,R,G,B
	if mode = 1
		c1 = rgb(r/2,g/2,b/2)
		c2 = rgb(255,255,255)
		else
		c2 = rgb(r/2,g/2,b/2)
		c1 = rgb(255,255,255)
	endif
	ink c1,0 : lbox(x,y,l,h)
	ink c2,0 : lbox(x,y,l-1,h-1)
	ink rgb(r,g,b),0 : box x+1,y+1,x+l-1,y+h-1
	ink 0,0 : center text x+l/2,y,t$
EndFunction