CameraVisible
CameraVisible CameraIndex, VisFlag
 
Parameters:

    CameraIndex = The Index Identifier of the Camera that you wish to read from
    VisFlag = On / OFF flag to toggle the cameras drawing on/off
Returns: NONE
 

      CameraVisible set the drawing (visibility) state of a camera. When a cameras draw state is set to 1 (ON), what it can see (it's visibility) can be will be drawn at will from from commands like DrawCamera, DrawAllCameras. If it's set to OFF(0) however, the camera will be not be drawn, even if requested.



FACTS:


      * By default CameraVisible is set to 1 (on)



Mini Tutorial:


      This example is two parts. Part1 creates a camera, adjusts it size to a custom view port, activates the Auto CLS an sets it's CLS colour to a bright green colour, before drawing a circle to the scene buffer and finally displaying the camera. Part2 then lets the user press the spacekey to toggle the CameraVisible flag, to selectively turn camera drawing ON or OFF



  
; ===========================
; Part 1
; ===========================
  
; create camera 1.  Which will attach itself to
; the current surface, which will be the screen
; by default
  CreateCamera 1
  
; Set the Cameras View Port area to 100x,100x to 200,200
  CameraViewPort 1,100,100,200,200
  
; Activate the camera Auto CLS to screen the cameras viewport
; before it starts drawing
  CameraCls 1,on
  
; Set the Cameras Auto CLS colour to Bright green colour
  CameraClsColour 1,RGB(0,255,0)
  
; Now redirect All gfx output to the Scene buffer, so the
; camera  has something To view.
  CaptureToScene
  
; draw a white circle the Scene
  Circle 50,50,40,1
  
; Tell PB to retutrn to drawing GFX immediately
  DrawGFXImmediate
  
; ===========================
; Part 2
; ===========================
  
  
; Start a Do /loop
  Do
     
   ; Clear the Screen to black
     Cls RGB(0,0,0)
     
   ; Display message
     Print "Press Space to Toggle Cameras Visibility"
   ; Display cameras current visiblity State
     Print "Cameras Visiblity state:"+Str$(GetCameraVisible(1))
     
   ; Check if the Space Key was pressed
     If SpaceKey()=true
      ; Invert the cameras visible state
        CameraVisible 1,Not GetCameraVisible(1)
     EndIf
     
   ; Draw the camera and whatever it can see from the
   ; scene buffer
     DrawCamera 1
     
   ; Show the user the screen.
     Sync
     
   ; Loop back to the DO statement
  Loop
  
  



This example would output.

  
  no Text output
  


 
Related Info: DrawAllCameras | DrawCamera | GetCameraVisible :
 


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