Class: CameraViewport

rune.camera.CameraViewport(camera)

The CameraViewport class represents a camera's viewport in the form of a rectangle. DisplayObject located inside the viewport is rendered to the camera's pixel buffer.

Constructor

new CameraViewport(camera)

Creates a CameraViewport object.
Parameters:
Name Type Description
camera rune.camera.Camera Reference to the camera object to which the viewport is connected.
Source:

Extends

Members

bottom :number

The sum of the y and height properties.
Type:
  • number
Inherited From:
Source:

bottomLeft :rune.geom.Rectangle

The location of the Rectangle object's bottom-left corner, determined by the values of the left and bottom properties.
Type:
Inherited From:
Source:

bottomRight :rune.geom.Rectangle

The location of the Rectangle object's bottom-right corner, determined by the values of the right and bottom properties.
Type:
Inherited From:
Source:

center :rune.geom.Point

The center point of the rectangle object.
Type:
Inherited From:
Source:

centerX :number

The x coordinate of the center of the object.
Type:
  • number
Inherited From:
Source:

centerY :number

The y coordinate of the center of the object.
Type:
  • number
Inherited From:
Source:

height :number

The height of the rectangle, in pixels.
Type:
  • number
Overrides:
Source:

left :number

The x coordinate of the top-left corner of the rectangle.
Type:
  • number
Inherited From:
Source:
The sum of the x and width properties.
Type:
  • number
Inherited From:
Source:

size :rune.geom.Point

The size of the Rectangle object, expressed as a Point object with the values of the width and height properties.
Type:
Inherited From:
Source:

top :number

The y coordinate of the top-left corner of the rectangle.
Type:
  • number
Inherited From:
Source:

topLeft :rune.geom.Point

The location of the Rectangle object's top-left corner, determined by the x and y coordinates of the point.
Type:
Inherited From:
Source:

topRight :rune.geom.Point

The location of the Rectangle object's top-right corner, determined by the x and y coordinates of the point.
Type:
Inherited From:
Source:

width :number

The width of the rectangle, in pixels.
Type:
  • number
Overrides:
Source:

x :number

The horizontal coordinate of the point. The default value is 0.
Type:
  • number
Inherited From:
Source:

y :number

The vertical coordinate of the point. The default value is 0.
Type:
  • number
Inherited From:
Source:

zoom :number

Current zoom value, where 1.0 is the default, ie. rendered on a 100% scale. The value can vary between 0.25 (min) and 4.0 (max).
Type:
  • number
Source:

Methods

containsPoint(point) → {boolean}

Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
Parameters:
Name Type Description
point rune.geom.Point The point, as represented by its x and y coordinates.
Inherited From:
Source:
Returns:
A value of true if the Rectangle object contains the specified point; otherwise false.
Type
boolean

containsRectangle(rect) → {boolean}

Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object. A Rectangle object is said to contain another if the second Rectangle object falls entirely within the boundaries of the first.
Parameters:
Name Type Description
rect rune.geom.Rectangle The Rectangle object being checked.
Inherited From:
Source:
Returns:
A value of true if the Rectangle object that you specify is contained by this Rectangle object; otherwise false.
Type
boolean

distance(point) → {number}

Returns the distance between the current and specified point.
Parameters:
Name Type Description
point rune.geom.Point The specified point.
Inherited From:
Source:
Returns:
Type
number

interpolate(point, fractionopt, outputopt) → {rune.geom.Point}

Determines a point between two specified points. The parameter fraction determines where the new interpolated point is located relative to the two end points.
Parameters:
Name Type Attributes Description
point rune.geom.Point The second point.
fraction number <optional>
The level of interpolation between the two points.
output rune.geom.Point <optional>
Save results to this object.
Inherited From:
Source:
Returns:
The new, interpolated point.
Type
rune.geom.Point

intersection(toIntersect, outputopt) → {rune.geom.Rectangle}

If the Rectangle object specified in the toIntersect parameter intersects with this Rectangle object, returns the area of intersection as a Rectangle object. If the rectangles do not intersect, this method returns an empty Rectangle object with its properties set to 0.
Parameters:
Name Type Attributes Description
toIntersect rune.geom.Rectangle The Rectangle object to compare against to see if it intersects with this Rectangle object.
output rune.geom.Rectangle <optional>
A Rectangle object to store the intersection results in.
Inherited From:
Source:
Returns:
A Rectangle object that equals the area of intersection.
Type
rune.geom.Rectangle

intersects(toIntersect) → {boolean}

Determines whether the object specified in the toIntersect parameter intersects with this Rectangle object.
Parameters:
Name Type Description
toIntersect rune.geom.Rectangle The Rectangle object to compare against this Rectangle object.
Inherited From:
Source:
Returns:
A value of true if the specified object intersects with this Rectangle object; otherwise false.
Type
boolean

toString() → {string}

Returns a string representation of the hitbox. Useful for troubleshooting.
Overrides:
Source:
Returns:
Type
string