Viewport
Extends:
A viewport is a display port on the game canvas. Each scene can have multiple viewports and renderable objects are assigned to the ones they want to be drawn on.
Viewports contain lighting and cameras.
GameObjects and their components exist across all viewports, it is up to the programmer to specify the viewports to render to.
Examples on when to use viewports:
- UI
- Minimaps
- Different views
TODO: An object of keys represented by 'z' indexes to store all renderable objects in render order.
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
getBounds(): * |
|
public |
registerRenderableComponent(renderable: Renderable): * Register an Updateable component with this viewport for drawing. |
|
public |
setBounds(x: *, y: *, w: *, h: *) |
Inherited Summary
From class Updateable | ||
public |
deregister: * |
|
public |
|
|
public |
|
|
public |
id: * |
|
public |
Cleanup code for when destroying an Updateable. |
|
public |
end() Base call function for when this Updateable is to be ended. |
|
public |
onEnd() Called when the object is being removed or cleaned up from usage. |
|
public |
onPause() Called when the object is intended to be paused. |
|
public |
onStart() Called when the the object is first introduced. |
|
public |
Called when the object is to be unpaused from paused state. |
|
public |
onUpdate() Called on every update within the game, once the object has had onStart called. |
|
public |
pause() Base call function for when this Updateable is to be paused. |
|
public |
start() Base call function for when this Updateable is to be started. |
|
public |
unpause() Base call function for when this Updateable is to be unpaused. |
|
public |
update() Base call function for when this Updateable is to be updated. |
Public Constructors
Public Members
public renderables: {} source
Private Members
private _bounds: * source
private _rendererBounds: * source
Public Methods
public registerRenderableComponent(renderable: Renderable): * source
Register an Updateable component with this viewport for drawing.
Params:
Name | Type | Attribute | Description |
renderable | Renderable | Renderable component to register. |
Return:
* |
public setBounds(x: *, y: *, w: *, h: *) source
Params:
Name | Type | Attribute | Description |
x | * | ||
y | * | ||
w | * | ||
h | * |