Class: Cameras

rune.camera.Cameras(input)

The Cameras class represents a camera system with the ability to create, delete and manage camera objects.

Constructor

new Cameras(input)

Creates a new Cameras instance.
Parameters:
Name Type Description
input rune.display.Stage What the camera system should render.
Source:

Members

(readonly) length :number

Returns the number of available cameras.
Type:
  • number
Source:

Methods

addCamera(camera) → {rune.camera.Camera}

Adds a Camera instance to this Cameras instance.
Parameters:
Name Type Description
camera rune.camera.Camera The camera to add.
Source:
Throws:
If no valid camera object.
Type
TypeError
Returns:
Type
rune.camera.Camera

createCamera(xopt, yopt, widthopt, heightopt) → {rune.camera.Camera}

Creates a new Camera instance.
Parameters:
Name Type Attributes Default Description
x number <optional>
0 Camera position in x coordinates.
y number <optional>
0 Camera position in y coordinates.
width number <optional>
384 Camera size in width.
height number <optional>
216 Camera size in height.
Source:
Returns:
The new camera object.
Type
rune.camera.Camera

getCameraAt(index) → {rune.camera.Camera}

Returns the camera object instance that exists at the specified index.
Parameters:
Name Type Description
index number The index position of the camera object.
Source:
Throws:
Throws if the index does not exist in the camera list.
Type
RangeError
Returns:
Type
rune.camera.Camera

getCameras() → {Array.<rune.camera.Camera>}

Returns all Camera instances. Note that this method is primarily intended for internal use.
Source:
Returns:
Type
Array.<rune.camera.Camera>

removeCamera(camera, disposeopt) → {rune.camera.Camera}

Removes a specific Camera instance.
Parameters:
Name Type Attributes Default Description
camera rune.camera.Camera Camera to remove.
dispose boolean <optional>
false If the Camera instance is to be completely removed from memory.
Source:
Throws:
If invalid camera object.
Type
TypeError
Returns:
Type
rune.camera.Camera

removeCameras(disposeopt) → {undefined}

Removes all Camera instances.
Parameters:
Name Type Attributes Default Description
dispose boolean <optional>
false If the Camera instances are to be completely removed from memory.
Source:
Returns:
Type
undefined

splitScreen(count, orientationopt) → {undefined}

Arranges one to four cameras over the application's internal screen area. Disposes all existing cameras through removeCameras(true), then creates a fresh set through createCamera()/addCamera(). Previous targets, effects, zoom settings and external camera references do not carry over. Configure the new cameras after this call. Invalid layout arguments leave cameras intact. One camera fills the screen. Two cameras use left/right panes by default; horizontal uses top/bottom. Three or four cameras use a two-by-two grid in row-major order, leaving the bottom-right pane unused with three cameras. Pixel boundaries are rounded independently so odd resolutions have no gaps. Call again after a screen resolution change; layout is not updated implicitly.
Parameters:
Name Type Attributes Default Description
count number Number of cameras, an integer from one to four.
orientation string <optional>
"vertical" Two-player layout: vertical or horizontal.
Source:
Throws:
  • If count, orientation or screen dimensions are invalid.
    Type
    RangeError
  • If the camera system has been disposed.
    Type
    Error
Returns:
Type
undefined