SpriteRender

Inherited: Renderable

Description

The SpriteRender component allows you to display images as sprites to use in both 2D and 3D scenes.

Public Methods

Vector4

color () const

int

drawMode () const

std::string

item () const

int

layer () const

void

setColor (const Vector4 color)

void

setDrawMode (int mode)

void

setItem (const std::string item)

void

setLayer (int layer)

void

setSize (const Vector2 size)

void

setSprite (Sprite * sprite)

void

setTexture (Texture * texture)

Vector2

size () const

Sprite *

sprite () const

Texture *

texture () const

Public Enums

enum SpriteRender::DrawMode

Constant

Value

Description

SpriteRender::Simple

0

The SpriteRender will draw sprite as is.

SpriteRender::Sliced

1

The SpriteRender will respect 9 patch slicing rules for the size property.

SpriteRender::Tiled

2

The SpriteRender will duplicate sprites to fill the size property rectangle.

Static Methods

None

Methods Description

Vector4 SpriteRender::color () const

Returns the color of the sprite to be drawn.

See also setColor().


int SpriteRender::drawMode () const

Returns a draw mode for the sprite. Please check SpriteRender::DrawMode for more details.

See also setDrawMode().


std::string SpriteRender::item () const

Returns the current item name of sprite from the sprite sheet.

See also setItem().


int SpriteRender::layer () const

Returns the order layer for the sprite.

See also setLayer().


void SpriteRender::setColor (Vector4 color)

Changes the color of the sprite to be drawn.

See also *color*().


void SpriteRender::setDrawMode (int mode)

Sets a draw mode for the sprite. Please check SpriteRender::DrawMode for more details.

See also drawMode().


void SpriteRender::setItem (std::string item)

Sets the current sub item name of sprite from the sprite sheet.

See also *item*().


void SpriteRender::setLayer (int layer)

Sets the order layer for the sprite.

See also *layer*().


void SpriteRender::setSize (Vector2 size)

Sets a new size of sprite.

See also *size*().


void SpriteRender::setSprite (Sprite * sprite)

Replaces current sprite with a new one.

See also *sprite*().


void SpriteRender::setTexture (Texture * texture)

Replaces current texture with a new one.

See also *texture*().


Vector2 SpriteRender::size () const

Returns size of sprite.

See also setSize().


:ref:`Sprite<api_Sprite>`* SpriteRender::sprite () const

Returns a sprite.

See also setSprite().


:ref:`Texture<api_Texture>`* SpriteRender::texture () const

Returns current assigned texture.

See also setTexture().