GetCameraSurface
Surface = GetCameraSurface(CameraIndex)
 
Parameters:

    CameraIndex = The index of the camera to query
Returns:

    Surface = The drawing surface of this camera
 

      The GetCameraSurface function returns the surface this camera is attached to. When a camera is created, it'll be attached to the current render surface(See GetSurface). Which can either be an image or the screen.


      [Surface Return Values]:

           0 = Camera is attached to the screen
           1 = Camera is attached to image 1
           2 = Camera is attached to image 2
           etc etc




FACTS:


      * When a camera is created it is attached to current draw surface. Which will be either the SCREEN or an IMAGE.





Mini Tutorial:


      This example simply creates a camera and display the surface the camera is attached to. Which in this case, will be the screen.



  
; Create a camera
  Cam=NewCamera()
  
; Display surface this camera is attached to
  Print GetCameraSurface(Cam)
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  




This example would output.

  
  0
  






Mini Tutorial:


This example is the same as the previous, except this time the newly create camera get attached to an Image, since that's the current surface at the time the camera was created.


  
  
; Create image #50 with a width of 400 and height of 300
  CreateImage 50,400,400
  
; Tell PB to draw to this new image
  RenderToImage 50
  
  
; Create a camera
  Cam=NewCamera()
  
  
; Tell PB to restore rendering to the screen
  RenderToScreen
  
; Display surface this camera is attached to
  Print GetCameraSurface(Cam)
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  



This example would output.

  
  50
  





 
Related Info: CreateCamera | NewCamera :
 


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