Class R.components.render.Sprite
Extends
R.components.Render.
A render component that renders its contents from a R.resources.types.Sprite. Sprites
are 2d graphics which are either a single frame (static) or multiple frames
(animation). The sprite's descriptor will define that for the component.
Defined in: sprite.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.render.Sprite(name, priority, sprite)
Create a sprite component.
|
- 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 |
---|---|
execute(renderContext, time, dt)
Draw the sprite to the render context.
|
|
Get the class name of this object
|
|
Get the sprite the component is rendering.
|
|
release()
Releases the component back into the object pool.
|
|
setSprite(sprite)
Set the sprite the component will render.
|
- Methods borrowed from class R.components.Render:
- destroy, getDrawMode, setDrawMode, transformOrigin
- Methods borrowed from class R.components.Base:
- getGameObject, getHostObject, getPriority, getType, getTypeString, setGameObject, setHostObject, 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.Sprite(name, priority, sprite)
Create a sprite component.
- Parameters:
- name
- {String} The component name
- priority Optional, Default: 0.1
- {Number} The render priority
- sprite
- {R.resources.types.Sprite} The sprite to render
Method Detail
execute(renderContext, time, dt)
Draw the sprite to the render context. The frame, for animated
sprites, will be automatically determined based on the current
time passed as the second argument.
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The context to render to
- 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.Sprite"
{R.resources.types.Sprite}
getSprite()
Get the sprite the component is rendering.
- Returns:
- {R.resources.types.Sprite} A R.resources.types.Sprite instance
release()
Releases the component back into the object pool. See R.engine.PooledObject#release for
more information.
setSprite(sprite)
Set the sprite the component will render.
- Parameters:
- sprite
- {R.resources.types.Sprite} The sprite to render