GetCameraVisible
Flag = GetCameraVisible(CameraIndex)
 
Parameters:

    CameraIndex = The Index Identifier of the Camera that you wish to read from
Returns:

    Flag = The current camera visible state. (0 = Off, can't be drawn, 1 = On drawn as normal)
 

      The GetCameraVisible functions returns the current state of the camera visible flag.



FACTS:


      * By default the CameraVisible flag 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 slectively turn camera drawing ON or OFF



  
  
; ============================
; Part 1 - Set up Camera
; ============================
  
; 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 - The main Loop
; ============================
  
  
; 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: CameraVisible | DrawCamera | GetCameraStatus :
 


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