Home Reference Source Test
import Viewport from 'seed-engine/src/render/Viewport.js'
public class | source

Viewport

Extends:

Updateable → Viewport

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

Member Summary

Public Members
public
Private Members
private

_bounds: *

private

Method Summary

Public Methods
public

getBounds(): *

public

Register an Updateable component with this viewport for drawing.

public

setBounds(x: *, y: *, w: *, h: *)

Inherited Summary

From class Updateable
public
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

Called when the object is intended to be paused.

public

Called when the the object is first introduced.

public

Called when the object is to be unpaused from paused state.

public

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

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 constructor() source

Override:

Updateable#constructor

Public Members

public renderables: {} source

Private Members

private _bounds: * source

private _rendererBounds: * source

Public Methods

public getBounds(): * source

Return:

*

public registerRenderableComponent(renderable: Renderable): * source

Register an Updateable component with this viewport for drawing.

Params:

NameTypeAttributeDescription
renderable Renderable

Renderable component to register.

Return:

*

public setBounds(x: *, y: *, w: *, h: *) source

Params:

NameTypeAttributeDescription
x *
y *
w *
h *