Rendering.Camera2d

Description: Defines a camera that is used to define a viewport. Should be used in conjunction with a Camera2dRenderer to render graphics as if being viewed through a camera.

Extends: EndGate.Bounds.BoundingRectangle

Constructors

Camera2d (position, size)
Creates a new instance of the Camera2d object.

position: EndGate.Vector2d
Initial position of the camera.

size: EndGate.Size2d
Initial size of the camera.

Fields

(Static) DefaultDistance: number
The distance in which the Camera2d will default to and the distance that defines the 100% scale value.

Distance: number
Gets or sets the camera distance. This represents how far away the Camera is from the game canvas. 0 is directly on top of the canvas while DefaultDistance represents 100% scale.

Inherited from: EndGate.Bounds.BoundingRectangle

Position: EndGate.Vector2d
Gets or sets the Position of the bounds.

Rotation: number
Gets or sets the Rotation of the bounds.

Size: EndGate.Size2d
Gets or sets the Size of the rectangle.

TopLeft: EndGate.Vector2d
Gets the top left corner of the BoundingRectangle.

TopRight: EndGate.Vector2d
Gets the top right corner of the BoundingRectangle.

BotLeft: EndGate.Vector2d
Gets the bottom left corner of the BoundingRectangle.

BotRight: EndGate.Vector2d
Gets the bottom right corner of the BoundingRectangle.

Methods

ToCameraRelative()
Converts an absolute position (0 to cameras Size) to a camera relative position. Most useful when used to convert mouse click coordinates to scene coordinates.

Inherited from: EndGate.Bounds.BoundingRectangle

Scale()
Abstract: Scales the size of the bounded object.

ContainsPoint()
Abstract: Determines if the current bounded object contains the provided Vector2d.

ContainsCircle()
Abstract: Determines if the current bounded object completely contains the provided BoundingCircle.

ContainsRectangle()
Abstract: Determines if the current bounded object completely contains the provided BoundingRectangle.

Contains()
Abstract: Determines if the current bounded object contains the provided Vector2d.

Intersects()
Determines if the current bounded object intersects another bounded object.

IntersectsCircle()
Abstract: Determines if the current bounded object is intersecting the provided BoundingCircle.

IntersectsRectangle()
Abstract: Determines if the current bounded object is intersecting the provided BoundingRectangle.

Scale()
Scales the width and height of the BoundingRectangle.

Corners()
Returns a list of vertices that are the locations of each corner of the BoundingRectangle. Format: [TopLeft, TopRight, BotLeft, BotRight].

IntersectsCircle()
Determines if the current BoundingRectangle is intersecting the provided BoundingCircle.

IntersectsRectangle()
Determines if the current BoundingRectangle is intersecting the provided BoundingRectangle.

ContainsPoint()
Determines if the current BoundingRectangle contains the provided Vector2d.

ContainsCircle()
Determines if the current BoundingRectangle completely contains the provided BoundingCircle.

ContainsRectangle()
Determines if the current BoundingCircle completely contains the provided BoundingRectangle.

Examples

There's currently no example available for this page. If you'd like to suggest one send me an containing a description, code, and link to the page for the suggested example. As a thanks I'll associate the code snippet with your name directly below the example if approved.