Class R.components.render.Billboard2D
Extends
R.components.Render.
The billboard component renders the contents of an image which
was generated by a linked render component. When the contents
of the linked component are re-rendered, the contents of the
image are updated. The best usage of this component is for infrequently
changing vector drawn objects. For example:
// Add component to draw the object this.add(R.components.Billboard2D.create("draw", R.components.Vector2D.create("vector")));Accessing the R.components.Vector2D within the R.components.Billboard2D is as simple as calling #getComponent. If the contents of the linked component are updated, you will need to call #regenerate to recreate the billboard image.
Defined in: billboard2d.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.render.Billboard2D(name, renderComponent, priority)
Creates a 2d billboard component.
|
Field Attributes | Field Name and Description |
---|---|
The component will render the contents of the billboard.
|
|
The component will render to a temporary context from which the
actual content will be rendered.
|
- Fields borrowed from class R.components.Render:
- DRAW, NO_DRAW
- Fields borrowed from class R.components.Base:
- TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroy the object
|
|
execute(renderContext, time, dt)
Draws the contents of the billboard to the render context.
|
|
Get the class name of this object
|
|
Get the linked render component.
|
|
Call this method when the linked render component has been updated
to force the billboard to be redrawn.
|
|
release()
Releases the component back into the object pool.
|
|
setGameObject(hostObject)
Establishes the link between this component and its game object.
|
|
setHostObject(hostObject)
Deprecated in favor of #setGameObject.
|
- Methods borrowed from class R.components.Render:
- getDrawMode, setDrawMode, transformOrigin
- Methods borrowed from class R.components.Base:
- getGameObject, getHostObject, getPriority, getType, getTypeString, setPriority
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.render.Billboard2D(name, renderComponent, priority)
Creates a 2d billboard component.
- Parameters:
- name
- {String} The name of the component
- renderComponent
- {R.components.Render} A render component to create the billboard from
- priority
- {Number} The priority of the component between 0.0 and 1.0
Field Detail
NORMAL
The component will render the contents of the billboard.
REDRAW
The component will render to a temporary context from which the
actual content will be rendered.
Method Detail
destroy()
Destroy the object
execute(renderContext, time, dt)
Draws the contents of the billboard to the render context. This
component operates in one of two modes. When the contents of the
subclassed component are redrawing, a temporary render context is created
to which the component renders. The second mode is where the contents
of the context from the first mode are rendered instead of performing
all of the operations required to render the component. This component
is only good if the contents don't change often.
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The rendering context
- time
- {Number} The engine time in milliseconds
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.components.render.Billboard2D"
{R.components.Render}
getComponent()
Get the linked render component.
- Returns:
- {R.components.Render}
regenerate()
Call this method when the linked render component has been updated
to force the billboard to be redrawn.
release()
Releases the component back into the object pool. See R.engine.PooledObject#release
for more information.
setGameObject(hostObject)
Establishes the link between this component and its game object.
When you assign components to a game object, it will call this method
so that each component can refer to its game object, the same way
a game object can refer to a component with R.engine.GameObject#getComponent.
- Parameters:
- hostObject
- {R.engine.GameObject} The object which hosts this component
setHostObject(hostObject)
Deprecated in favor of #setGameObject.
- Parameters:
- hostObject