Posted: 24th Dec 2003 17:32
And here it is!!!!! a multicamera function for DarkBASIC classic, you can now make splitscreens like in mario kart etc.
here is an example, with the function:


+ Code Snippet
autocam off
sync on
sync rate 0
`make something to look at
ink rgb(230,0,0),rgb(0,0,120)
for i = 1 to 50
 dot rnd(20),rnd(20)
next i
get image 1,0,0,20,20
make object box 1,100,20,50
texture object 1,1
position object 1,0,0,0


do
y#=wrapvalue(y#+2)
yrotate object 1,y#

`make sure that all the hud things are typed before you type the multicam function

`hud
text 40,40,"FRONT VIEW"
`multicam function
place_multi_camera(-150.0,0.0,-150.0,0.0,45.0,0.0,1)
`hud
text 360,260,"TOP VIEW"
`multicam function
place_multi_camera(0.0,150.0,0.0,90.0,0.0,0.0,4)


`remove this sync and see what happens
sync

loop


function place_multi_camera(xpos#,ypos#,zpos#,xang#,yang#,zang#,viewport)

 if viewport=0
    do
     set cursor 0,0
     print "viewport doesn't exist"
    loop
 endif

 if viewport > 4
    do
     set cursor 0,0
     print "viewport doesn't exist"
    loop
 endif

 position camera xpos#,ypos#,zpos#
 rotate camera xang#,yang#,zang#

 if viewport = 1 then set camera view 0,0,screen width()/2,screen height()/2
 if viewport = 2 then set camera view screen width()/2,screen height()/2,screen width(),screen height()  
 if viewport = 3 then set camera view 0,screen height()/2,screen width()/2,screen height()
 if viewport = 4 then set camera view screen width()/2,screen height()/2,screen width(),screen height()

endfunction