Rem FX Mini Browser
Rem Created: 28/06/2003 03:57:13
rem Init app
sync on : sync rate 60 : hide mouse : backdrop off
rem Obtain information on shader capabilities
vs#=get maximum vertex shader version()
ps#=get maximum pixel shader version()
rem Screen dimensions
gap=screen height()/20
topline=gap+60
halfwidth=screen width()/2
middleline=screen width()/2
bottomline=screen height()-gap
verthalfline=topline+((bottomline-topline)/2)
rightline=screen width()-gap
displaymax=((bottomline-topline)/18)-2
valuesdisplaymax=((bottomline-(verthalfline+gap))/18)-2
displaywidthmax=((middleline-leftline)/10)-2
valuesdisplaywidthmax=((rightline-middleline)/10)-9
rem Create list of FX files
dim list$(0) : empty array list$()
scandir("fx","")
listmax=2+array count(list$())
listtop=1
rem Create list of Effect Values
type valuestype name$ vartype hooked endtype
dim values$(0) as valuestype : empty array values$()
valuesmax=1+array count(values$())
valuestop=1
rem Setup camera and light for preview camera
position camera 0,0,0,-1000
make camera 1 : set camera view 1,middleline,topline,rightline,verthalfline
set camera aspect 1,(rightline-middleline)/((verthalfline-topline)+0.0)
backdrop on 1 : color backdrop 1,0
rem Current vars
highlight=1 : valueshighlight=1 : loadeffect=1
rem Initialise interface screen
gosub _initscreen
rem Move around world
do
rem control interface
if invalues=0
`
rem control list highlight
if scancode()=0 then keypress=0
if keypress=0
if upkey()=1 and highlight>1 then dec highlight : keypress=1
if downkey()=1 and highlightlisttop+displaymax then listtop=highlight-displaymax
if highlight1 then dec valueshighlight : keypress=1
if downkey()=1 and valueshighlightvaluestop+valuesdisplaymax then valuestop=valueshighlight-valuesdisplaymax
if valueshighlight-1
effect$=list$(loadeffect-1)
gosub _loadmodelandeffect
loadeffect=-1
endif
rem Rotate any model in view
if object exist(1)=1
yrotate object 1,wrapvalue(object angle y(1)+1)
endif
rem Move light around slightly
l#=l#+4.0 : set point light 0,camera position x(1)+(cos(l#)*2),camera position y(1)+(sin(l#)*2),camera position z(1)-1
rem refresh interface
gosub _refreshscreen
rem update screen
sync
rem end loop
loop
`
` Subroutines for Interface
`
_initscreen:
rem Clear screen
create bitmap 1,screen width(),screen height()
set current camera 0 : draw to back
cls rgb(192,192,192)
rem Setup font
set text font "Courier New"
set text transparent
rem Write labels
set text size 20
ink rgb(0,0,0),0 : center text halfwidth,(gap/2)-10,"DBPRO FX MINI-BROWSER"
set text size 16
center text halfwidth,(gap/2)+10,"[ARROWKEYS] TO NAVIGATE [TAB] TO TOGGLE [T] TRANSPOSE TOGGLE"
center text gap+((middleline-(gap*2))/2),topline-20,"FX FILES"
center text middleline+((rightline-middleline)/2),topline-20,"PREVIEW AREA"
center text middleline+((rightline-middleline)/2),verthalfline+gap-20,"EFFECT VALUES"
center text halfwidth,bottomline+(gap/2)-10,"VERTEX SHADER VERSION:"+str$(vs#)+" PIXEL SHADER VERSION:"+str$(ps#)
rem Text for boxout
set current bitmap 0
set text opaque
return
_refreshscreen:
rem Clear screen
set current camera 0
copy bitmap 1,0
ink rgb(0,0,0),rgb(192,192,192)
if invalues=0
center text halfwidth,(gap/2)+30,"[RETURN] TO USE AUTO-SPHERE [SPACE] TO LOAD EFFECT"
else
center text halfwidth,(gap/2)+30,"[SPACE] TO SET RANDOM VALUE TO EFFECT VALUE"
endif
rem Panel for FX list
ink 0,0 : box gap,topline,middleline-gap,bottomline
ink rgb(255,255,255),0
for n=0 to displaymax
if listtop+n-1
file$=get file name$()
if file$="." or file$=".."
rem ignore . and ..
else
if get file type()=1
scandir(file$,rel$+file$+"\")
find first
if fin>0
for t=1 to fin : find next : next t
endif
else
if lower$(right$(file$,3))=".fx"
array insert at bottom list$()
list$()=rel$+file$
endif
endif
endif
find next
fin=fin+1
endwhile
set dir ".."
`
endfunction