tässä tarvittavat muuttujat:
Code: Select all
Const maxlehdet =2 //kuinka monta nappian on ja ladataan?
Dim lehdet(maxlehdet)//itse lehdet
Code: Select all
Function DrawLehti(x,y,txt$,id)
If lehdet(id)=0 Then
//tekstit
Color cbblack
If MouseX()>x And MouseX()<x+TextWidth(txt)+10 And MouseY()>y And MouseY()<y+ TextHeight(txt)+4 Then Color cbred
Box x+2,y+2,TextWidth(txt)+10-4,TextHeight(txt),0
Color cbwhite
If MouseX()>x And MouseX()<x+TextWidth(txt)+10 And MouseY()>y And MouseY()<y+ TextHeight(txt)+4 Then Color cbpink
Text x+5,y+2,txt
//rajat
Color 150,150,0
Box x,y,TextWidth(txt)+10,TextHeight(txt)+4,0
Color 80,80,80
Box x-1,y-1,TextWidth(txt)+12,TextHeight(txt)+5,0
//viiva
Color cbyellow
Line 0,y+TextHeight(txt)+7,ScreenWidth(),y+TextHeight(txt)+7
Color 255,255,100
Line 0,y+TextHeight(txt)+6,ScreenWidth(),y+TextHeight(txt)+6
Color 255,255,150
Line 0,y+TextHeight(txt)+5,ScreenWidth(),y+TextHeight(txt)+5
Color 255,255,200
Line 0,y+TextHeight(txt)+4,ScreenWidth(),y+TextHeight(txt)+4
Color 255,255,255
Line 0,y+TextHeight(txt)+3,ScreenWidth(),y+TextHeight(txt)+3
Color cbyellow
Box 0,y+TextHeight(txt)+7,ScreenWidth(),ScreenHeight()
Else
Color cbcyan
Box x+2,y+2,TextWidth(txt)+10-4,TextHeight(txt),0
Color cbLightBlue
Text x+5,y+2,txt
//rajat
//laatikko
Color cbyellow
Box x-1,y-1,TextWidth(txt)+12,TextHeight(txt)+5,0
Color 255,255,150
Box x-2,y-2,TextWidth(txt)+14,TextHeight(txt)+6,0
Color 255,255,200
Box x,y,TextWidth(txt)+10,TextHeight(txt)+4,0
//viiva
Color cbyellow
Line 0,y+TextHeight(txt)+7,ScreenWidth(),y+TextHeight(txt)+7
Color 255,255,100
Line 0,y+TextHeight(txt)+6,ScreenWidth(),y+TextHeight(txt)+6
Color 255,255,150
Line 0,y+TextHeight(txt)+5,ScreenWidth(),y+TextHeight(txt)+5
Color 255,255,200
Line 0,y+TextHeight(txt)+4,ScreenWidth(),y+TextHeight(txt)+4
Color 255,255,255
Line 0,y+TextHeight(txt)+3,ScreenWidth(),y+TextHeight(txt)+3
Color cbyellow
Box 0,y+TextHeight(txt)+7,ScreenWidth(),ScreenHeight()
EndIf
If MouseX()>x And MouseX()<x+TextWidth(txt)+10 And MouseY()>y And MouseY()<y+ TextHeight(txt)+4 And MouseHit(1) Then
For i=0 To maxlehdet
lehdet(i)=0
If i=id Then lehdet(id)=1 //että vain yksi voi olla valittuna
Next i
EndIf
EndFunction
Code: Select all
Const maxlehdet =3 //kuinka monta nappian on ja ladataan?
Dim lehdet(maxlehdet)//itse lehdet
lehdet(0)=1 //alussa eka lehti on valittuna
Repeat
Select lehti
Case 0
drawlehti(10,20,"Buttons",0)
drawlehti(80,20,"Graphics",1)
drawlehti(158,20,"Sounds",2)
drawlehti(270,20,"config file",3)
Case 1
Color cbwhite
Text 0,37,"Graphics:"
drawlehti(10,20,"buttons",0)
drawlehti(80,20,"graphics",1)
drawlehti(158,20,"Sounds",2)
drawlehti(270,20,"config file",3)
Case 2
Color cbwhite
Text 0,37,"Sounds:"
drawlehti(10,20,"buttons",0)
drawlehti(80,20,"graphics",1)
drawlehti(158,20,"Sounds",2)
drawlehti(270,20,"config file",3)
EndSelect
DrawScreen
Forever
Function DrawLehti(x,y,txt$,id)
If lehdet(id)=0 Then
//tekstit
Color cbblack
If MouseX()>x And MouseX()<x+TextWidth(txt)+10 And MouseY()>y And MouseY()<y+ TextHeight(txt)+4 Then Color cbred
Box x+2,y+2,TextWidth(txt)+10-4,TextHeight(txt),0
Color cbwhite
If MouseX()>x And MouseX()<x+TextWidth(txt)+10 And MouseY()>y And MouseY()<y+ TextHeight(txt)+4 Then Color cbpink
Text x+5,y+2,txt
//rajat
Color 150,150,0
Box x,y,TextWidth(txt)+10,TextHeight(txt)+4,0
Color 80,80,80
Box x-1,y-1,TextWidth(txt)+12,TextHeight(txt)+5,0
//viiva
Color cbyellow
Line 0,y+TextHeight(txt)+7,ScreenWidth(),y+TextHeight(txt)+7
Color 255,255,100
Line 0,y+TextHeight(txt)+6,ScreenWidth(),y+TextHeight(txt)+6
Color 255,255,150
Line 0,y+TextHeight(txt)+5,ScreenWidth(),y+TextHeight(txt)+5
Color 255,255,200
Line 0,y+TextHeight(txt)+4,ScreenWidth(),y+TextHeight(txt)+4
Color 255,255,255
Line 0,y+TextHeight(txt)+3,ScreenWidth(),y+TextHeight(txt)+3
Color cbyellow
Box 0,y+TextHeight(txt)+7,ScreenWidth(),ScreenHeight()
Else
Color cbcyan
Box x+2,y+2,TextWidth(txt)+10-4,TextHeight(txt),0
Color cbLightBlue
Text x+5,y+2,txt
//rajat
//laatikko
Color cbyellow
Box x-1,y-1,TextWidth(txt)+12,TextHeight(txt)+5,0
Color 255,255,150
Box x-2,y-2,TextWidth(txt)+14,TextHeight(txt)+6,0
Color 255,255,200
Box x,y,TextWidth(txt)+10,TextHeight(txt)+4,0
//viiva
Color cbyellow
Line 0,y+TextHeight(txt)+7,ScreenWidth(),y+TextHeight(txt)+7
Color 255,255,100
Line 0,y+TextHeight(txt)+6,ScreenWidth(),y+TextHeight(txt)+6
Color 255,255,150
Line 0,y+TextHeight(txt)+5,ScreenWidth(),y+TextHeight(txt)+5
Color 255,255,200
Line 0,y+TextHeight(txt)+4,ScreenWidth(),y+TextHeight(txt)+4
Color 255,255,255
Line 0,y+TextHeight(txt)+3,ScreenWidth(),y+TextHeight(txt)+3
Color cbyellow
Box 0,y+TextHeight(txt)+7,ScreenWidth(),ScreenHeight()
EndIf
If MouseX()>x And MouseX()<x+TextWidth(txt)+10 And MouseY()>y And MouseY()<y+ TextHeight(txt)+4 And MouseHit(1) Then
For i=0 To maxlehdet
lehdet(i)=0
If i=id Then lehdet(id)=1 //että vain yksi voi olla valittuna
Next i
EndIf
EndFunction