new Camera()
This component controls the game camera deciding where and how it should move. The camera also broadcasts messages when the window resizes or its orientation changes.
- Source:
Fires:
- platypus.Entity#event:camera-loaded
- platypus.Entity#event:camera-update
- platypus.Entity#event:render-update
Listens to Events:
- platypus.Entity#event:child-entity-added
- platypus.Entity#event:child-entity-updated
- platypus.Entity#event:follow
- platypus.Entity#event:load
- platypus.Entity#event:pointerdown
- platypus.Entity#event:pressmove
- platypus.Entity#event:pressup
- platypus.Entity#event:relocate
- platypus.Entity#event:render-world
- platypus.Entity#event:resize-camera
- platypus.Entity#event:shake
- platypus.Entity#event:tick
- platypus.Entity#event:world-loaded
Methods
isOnCanvas(bounds) → {Boolean}
Returns whether a particular display object intersects the camera's viewport on the canvas.
- Source:
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bounds |
PIXI.Rectangle
|
Object
|
The bounds of the display object.
|
Returns:
- Type:
-
Boolean
Whether the display object intersects the camera's bounds.
windowToWorld(windowVector, withOffset, vector) → {platypus.Vector}
Returns a world coordinate corresponding to a provided window coordinate.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
windowVector |
platypus.Vector
|
A vector describing a window position. |
withOffset |
Boolean
|
Whether to provide a world position relative to the camera's location. |
vector |
platypus.Vector
|
If provided, this is used as the return vector. |
worldToWindow(worldVector, withOffset, vector) → {platypus.Vector}
Returns a window coordinate corresponding to a provided world coordinate.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
worldVector |
platypus.Vector
|
A vector describing a world position. |
withOffset |
Boolean
|
Whether to provide a window position relative to the camera's location. |
vector |
platypus.Vector
|
If provided, this is used as the return vector. |