I thought I'd put this here for 2 reasons
1) its made on dbc
2) code snippets board is very unpopular now
`Setup
Sync on : Sync rate 0
`Interesting stuff
make object cube 1,100
set ambient light 0
color backdrop 52
make light 1
color light 1,rgb(255,0,0)
set light range 1,300
set point light 1,-100,50,-100
point light 1,0,0,0
make light 2
color light 2,rgb(0,255,0)
set light range 2,300
set point light 2,100,50,-100
point light 2,0,0,0
make light 3
color light 3,rgb(0,0,255)
set light range 3,300
set point light 3,100,-50,-100
point light 3,0,0,0
make light 4
color light 4,rgb(255,0,255)
set light range 4,300
set point light 4,0,100,0
point light 4,0,0,0
make object cube 2,-105
color object 2,rgb(255,255,255)
set object 2,1,1,1,1,0,1,0
make object cube 3,-106
color object 3,rgb(255,0,0)
set object 3,1,1,1,1,0,1,0
make object cube 4,-107
color object 4,rgb(0,255,0)
set object 4,1,1,1,1,0,1,0
make object cube 5,-108
color object 5,rgb(0,0,255)
set object 5,1,1,1,1,0,1,0
make object cube 6,-109
color object 6,rgb(255,255,0)
set object 6,1,1,1,1,0,1,0
make object cube 7,-110
color object 7,rgb(255,0,255)
set object 7,1,1,1,1,0,1,0
make object cube 8,-111
color object 8,rgb(0,255,255)
set object 8,1,1,1,1,0,1,0
x#=1.0
y#=2.0
z#=3.0
`Main Loop
Do
`Call Functions for GUI Elements
press=button("Speed up",100,100,100,30,1)
press=button("Slow down",100,150,100,30,2)
radio=Radio("Radio1",250,110,"Radio2",250,160,1,2)
infobox("X rotation",str$(x#),100,190,130,20)
infobox("Y rotation",str$(y#),100,220,130,20)
infobox("Z rotation",str$(z#),100,250,130,20)
`Do stuff with results
ink rgb(255,255,255),0
for rad=1 to 2000
if radio=rad
text 10,10,"Current radio: Radio "+str$(rad)
endif
next rad
if press=1 then inc x# : inc y# : inc z# : text 10,30,"Speeding up"
if press=2 then dec x# : dec y# : dec z# : text 10,30,"Slowing down"
if x#<1 then x#=1 : if y#<2 then y#=2 : if z#<3 then z#=3
if x#>360 then x#=360 : if y#>361 then y#=361 : if z#>362 then z#=362
`Background stuff
ax#=wrapvalue(ax#+x#)
ay#=wrapvalue(ay#+y#)
az#=wrapvalue(az#+z#)
for c=1 to 8
rotate object c,ax#,ay#,az#
next c
`End Loop
Sync
Loop
`Functions--
`Button
Function Button(text$,posx,posy,sizx,sizy,num)
mx=mousex()
my=mousey()
ink rgb(128,128,128),0
box posx,posy,posx+sizx,posy+sizy
ink rgb(255,255,255),0
box posx,posy,posx+2,posy+sizy
box posx,posy,posx+sizx,posy+2
ink rgb(0,0,0),0
box posx+sizx-2,posy+2,posx+sizx,posy+sizy
box posx+2,posy+sizy-2,posx+sizx,posy+sizy
if mx>posx and mx<posx+sizx
if my>posy and my<posy+sizy
if mouseclick()=1
click=num
ink rgb(100,100,100),0
box posx,posy,posx+sizx,posy+sizy
ink rgb(0,0,0),0
box posx,posy,posx+2,posy+sizy
box posx,posy,posx+sizx,posy+2
ink rgb(255,255,255),0
box posx+sizx-2,posy+2,posx+sizx,posy+sizy
box posx+2,posy+sizy-2,posx+sizx,posy+sizy
else
click=0
ink rgb(128,128,128),0
box posx,posy,posx+sizx,posy+sizy
ink rgb(255,255,255),0
box posx,posy,posx+2,posy+sizy
box posx,posy,posx+sizx,posy+2
ink rgb(0,0,0),0
box posx+sizx-2,posy+2,posx+sizx,posy+sizy
box posx+2,posy+sizy-2,posx+sizx,posy+sizy
endif
endif
endif
ink rgb(0,0,0),0
set text size 10
set text to normal
center text posx+(sizx/2),(posy+(sizy/2))-10,text$
Endfunction click
Function radio(text1$,pos1x,pos1y,text2$,pos2x,pos2y,opt1,opt2)
mx=mouseX()
my=mousey()
ink rgb(255,255,255),0
for r=1 to 5
circle pos1x,pos1y,r : circle pos2x,pos2y,r
next r
ink rgb(0,128,0),0
circle pos1x,pos1y,5 : circle pos2x,pos2y,5
if mx>pos1x-5 and mx<pos1x+5
if my>pos1y-5 and my<pos1y+5
if mouseclick()=1
select=opt1
endif
endif
endif
if mx>pos2x-5 and mx<pos2x+5
if my>pos2y-5 and my<pos2y+5
if mouseclick()=1
select=opt2
endif
endif
endif
for r=1 to 2
if select=opt1
ink rgb(0,128,0),0
circle pos1x,pos1y,r
ink rgb(255,255,255),0
circle pos2x,pos2y,r
endif
if select=opt2
ink rgb(255,255,255),0
circle pos1x,pos1y,r
ink rgb(0,128,0),0
circle pos2x,pos2y,r
endif
next r
ink rgb(0,0,0),0
set text size 10
set text to normal
text pos1x+10,pos1y-5,text1$ : text pos2x+10,pos2y-5,text2$
Endfunction Select
Function infobox(text$,info$,posx,posy,six,sizy)
ink rgb(255,255,255),0
set text size 10
set text to normal
text posx,posy,text$
ink rgb(0,0,0),0
box posx+text width(text$)+5,posy,posx+text width(text$)+50+sizx,posy+sizy
ink rgb(255,255,255),0
box posx+text width(text$)+6,posy+1,posx+text width(text$)+49+sizx,(posy+sizy)-1
ink rgb(0,0,0),0
set text size 10
set text to normal
text posx+text width(text$)+10,posy,info$
Endfunction
i started off making some GUI functions, then about 5 mins into it i thought.. "I wonder if it works with a 3d backgrund", it worked with a normal cube, so i decided to make it betterised