DrawCamera
DrawCamera CameraIndex
 
Parameters:

    CameraIndex = The Index Identifier of the Camera that you wish to create.
Returns: NONE
 

      DrawCamera will render what is in view of a camera (what's in front of it) to it's attached surface. What is drawn is determined by the position of the graphics elements that were captured to the scene buffer.


      For more information about cameras pease read the CameraBasics tutorial in the About Section.



FACTS:


      * DrawCamera will automatically Sort and draw the items in the Scene buffer, so those items with the lowest depth will be drawn in front of items with a higher depth.

      * Cameras by default have CameraCLS backdrop enabled.

      * See CameraSceneSort to stop the camera from sorting the scene items.


 
Example Source: Download This Example
;----------------------------------
; Init Program
;----------------------------------
  
  
; Create Camera 1.  This camera will default to the current
; surfaces size.  The current surface will be the PlayBasic
; screen.
  CreateCamera 1
  
  
; Tell PB o now capture the following gfx commands to the scene buffer
  CaptureToScene
  
  
; Render a bunch of randomly positioned DOTS / CIRCLES and BOXES.
; These are not drawn, but captured to the SCENE BUFFER stack.
  WorldWidth=1500
  WorldHeight=1500
  
  For lp =0 To 1000
     x=Rnd(WorldWidth)
     y=Rnd(Worldheight)
     w=Rnd(50)
     Select Rnd(2)
         Case 0
             DotC x,y,RndRGB()
         Case 1
             CircleC x,y,w,Rnd(1),RndRGB()
         Case 2
             BoxC x,y,x+w,y+w,Rnd(1),RndRGB()
     EndSelect
  Next
  
  
  
; Limit program to a top speed of 75 frames per second or less
  SetFPS 60
  
;----------------------------------
; Start the program mani loop
;----------------------------------
  Do
     
   ; This code lets the user control the camera using the
   ; ARROW keys
     Speed=5
     
   ; If the LeftKey is pressed, move camera left
     If LeftKey()=true   Then MoveCamera 1,-speed,0
     
   ; If the RightKey is pressed, move camera Right
     If RightKey()=true  Then MoveCamera 1,speed,0
     
   ; If the UpKey is pressed, move camera Up
     If UpKey()=true     Then MoveCamera 1,0,-speed
     
   ; If the DownKey is pressed, move camera Down
     If DownKey()=true   Then MoveCamera 1,0,speed
     
   ; draw what the camera can currently see
     DrawCamera 1
     
   ; Refresh the Screen
     Sync
   ;Loop back to the DO statement above
  Loop
  
  
  
 
Related Info: CameraViewPort | CreateCamera | DrawAllCameras | GetCameraStatus | GetCameraSurface :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com