Camera Functions

1.Overview #

The Game Pencil Engine was created around these functions not being called within the rendering functions of your game. Unexpected results may occur if these are called during the render-state of GPE.

2.Camera Functions #

int GPE.camera_on( int cameraId )

Returns true if the camera is in use. False if the camera is not in use and IS_NULL if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

void GPE.center_camera( int cameraId, int centerX, int centerY)

Centers the indexed camera[From 0 to 7] around the coordinates(centerX, centerY). In the event the position is off the screen the Game Pencil Engine automatically attempts to readjust it to stay within the scene boundaries.

Scope: GPE

Return type : void

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.
  • int centerX - the x-coordinate to center the camera around.
  • int centerY - the y-coordinate to center the camera around.

 

void GPE.disable_camera ( int cameraId)

Disables the indexed camera[ From 0 to 7].

Scope: GPE

Return type : void

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

void GPE.enable_camera ( int cameraId)

Enables the index camera[ From 0 to 7].

Scope: GPE

Return type : void

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_height( int cameraId )

Returns the height of the camera in pixels in the game world. Also returns IS_NULL if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_width( int cameraId )

Returns the width of the camera in pixels in the game world. Also returns IS_NULL if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_x( int cameraId )

Returns the top-left x-coordinate of the camera in pixels in the game world. Also returns IS_NULL if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_y( int cameraId )

Returns the top-left y-coordinate of the camera in pixels in the game world. Also returns IS_NULL if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_mouse_x( int cameraId )

Returns the calculated mouse x-coordinate inside of the camera in pixels in the game world. Also returns 0 if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_mouse_y( int cameraId )

Returns the calculated mouse y-coordinate inside of the camera in pixels in the game world. Also returns 0 if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_screen_height( int cameraId )

Returns the HEIGHT of the camera inside of the actual game screen. Also returns 0 if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_screen_width( int cameraId )

Returns the WIDTH of the camera inside of the actual game screen. Also returns 0 if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_screen_x( int cameraId )

Returns the X-COORDINATE of the camera inside of the actual game screen. Also returns 0 if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_camera_screen_y( int cameraId )

Returns the Y-COORDINATE of the camera inside of the actual game screen. Also returns 0 if the camera id it out of scope and/or invalid.

Scope: GPE

Return type : int

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.

 

int GPE.get_current_camera( )

Returns the id of the current camera in view. It ranges from 0 to 7. Useful for split-screen games, huds, etc.

Scope: GPE

Return type : int

Parameters: none

 

void GPE.move_camera(int cameraId, int newX, int newY)

Places the indexed camera[From 0 to 7] at the coordinates(newX, newY). In the event the position is off the screen the Game Pencil Engine automatically attempts to readjust it to stay within the scene boundaries.

Scope: GPE

Return type : void

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.
  • int newX - the x-coordinate to top-left align the camera around.
  • int newY - the y-coordinate to top-left align the camera around.

 

void GPE.setup_camera(int cameraId,int cameraX, int cameraY, int cameraW, int cameraH)

This function is used to place the location box of the camera(if enabled) on the screen.

Scope: GPE

Return type : void

Parameters:

  • int cameraId– the id of the system camera in use. Ranges from 0 to 7.
  • int cameraX - the x-coordinate on the SCREEN in which the camera will appear.
  • int cameraY - the y-coordinate  on the SCREEN in which the camera will appear.
  • int cameraW - the width of the camera on the SCREEN.
  • int cameraH - the height of the camera on the SCREEN.

 

 

bool GPE.split_screen(int screenTotal, bool verticallySplit,  bool useBlanks)

This function is used to classically split the screen into up to 8 screens. Alllowed values are from 1 to 8. Values out of bounds will make this function split the screen into only 1 camera. This function also disables all other cameras above the screenTotal amount.

Scope: GPE

Return type : bool

Parameters:

  • int screenTotal– the id of the system camera in use. Ranges from 0 to 7.
  • int verticallySplit- if set to true this function will setup vertical cameras. If set to false or defaulted this sets up horizontal cameras for a more wide-screen experience.
  • int useBlanks- if set to true this function will allow for all camera sizes to remain the same in the event of odd camera counts(3, 5 and 7). If set to false or defaulted. This will make top screen cameras larger than the older cameras.

 

Help Guide Powered by Documentor
Suggest Edit