multiple camera outputs to the screen by Attila7th Jul 2006 19:51
|
---|
Summary Sometimes it is helpfull to show the ouput of multiple cameras, this examples show how to do it Description There are 3 cameras running, one showing a overwview of the scene and in screensize, a rotating camera near the middle of the scene showing its aoutput on the top right of the screen and a moveable cam whch can be controled by the arrow-keys showing its output on the top right of the screen Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Rem Project: Multiple Cams Rem Created: 07.07.2006 - R. Bannier rem rem This program show how to use multiple cameras in DBPro rem sync on : sync rate 60 : set text font "Arial" ` Create Dummy-Images of 130x130 pixels ` we will need the imgs for the camera output of cam 2 and 3 ` make memblock 1,16900 make image from memblock 2,1 make image from memblock 3,1 ` Create some ground make matrix 1, 200,200,10,10 randomize matrix 1,10 update matrix 1 set matrix wireframe on 1 ` Create object on the ground ` a box and a cylinder ` make object box 1, 10,20,10 position object 1, 100,10,100 color object 1, rgb(255,0,0) ` make object cylinder 2, 20 position object 2, 80,10,100 color object 2, rgb(0,0,255) ` ` make a ball to represent camera 3 ` make object sphere 3,10 color object 3, rgb(255,255,32) ` ` make a ball to represent camera 2 ` make object sphere 4,10 color object 4, rgb(255,32,255) ` ` `Default camera to overview everithing ` position camera 0,30,0 point camera 100,5,100 ` ` Camera 2, put it on top of the cylinder ` make camera 2 position camera 2, 80,25,100 position object 4, camera position x(2),camera position y(2),camera position Z(2), ` Cam-Output to image 2 ` set camera to image 2,2,128,128 ` Position the Sprite (Output Screen) left/top ` sprite 2,0,0,2 ` ` Camera 2, moveable bey the arrow-keys ` make camera 3 position camera 3, 180,15,10 set camera to image 3,3,128,128 ` ` Position the Sprite (Output Screen) right/top ` sprite 3,640-128,0,3 sync a$="" r#=0 ink rgb(255,255,0),0 `---------------------------------------------- ` Main Loop `---------------------------------------------- while a$="" set text to bold set text size 14 center text 320,10,"Press Spacebar to exit" center text 320,28,"use arrow keys to control top right cam" set text size 12 set text to normal center text 320,46,"Cameras are represented by balls" center text 320,60,"Top/Left screen shows a rotating camera on top of the cylinder" center text 320,74,"Top/right screen shows a view from the moving yellow ball" control camera using arrowkeys 3,1,1 position object 3, camera position x(3),camera position y(3),camera position Z(3), sync ` Turn camera 2 left .5° r#=r#+.5 if r# >=360 then r#=0 yrotate camera 2,r# a$=inkey$() endwhile cls set text size 12 set text to bold center text 320,240,"Thank you for testing my program" center text 320,260,"Press any key" sync suspend for key end |