SpriteTile Class Reference

SpriteTile is a sprite for which you specify a tile index (1D or 2D) in a TextureInfo. More...

Inheritance diagram for SpriteTile:
SpriteBase Node

List of all members.

Public Member Functions

 SpriteTile ()
 SpriteTile constructor.
 SpriteTile (TextureInfo texture_info)
 SpriteTile constructor.
 SpriteTile (TextureInfo texture_info, Vector2i index)
 SpriteTile constructor.
 SpriteTile (TextureInfo texture_info, int index)
 SpriteTile constructor.
override Vector2 CalcSizeInPixels ()
 Based on the uv and texture dimensions, return the corresponding size in pixels.

Public Attributes

Vector2i TileIndex2D = new Vector2i(0,0)
 TileIndex2D defines the UV that will be used for this sprite.

Properties

int TileIndex1D [get, set]
 Instead of TileIndex2D you can also work with a flattened 1d index, for animation, etc.

Detailed Description

SpriteTile is a sprite for which you specify a tile index (1D or 2D) in a TextureInfo.

Note that the cost of using SpriteUV alone is heavy, try as much as you can to use then as children of SpriteList.


Constructor & Destructor Documentation

SpriteTile constructor.

TileIndex2D is set to (0,0) by default.

SpriteTile ( TextureInfo  texture_info)

SpriteTile constructor.

TileIndex2D is set to (0,0) by default.

SpriteTile ( TextureInfo  texture_info,
Vector2i  index 
)

SpriteTile constructor.

TileIndex2D is set to (0,0) by default.

Parameters:
texture_infoThe tiled texture object.
index2D tile index. (0,0) is the bottom left tile.
SpriteTile ( TextureInfo  texture_info,
int  index 
)

SpriteTile constructor.

Parameters:
texture_infoThe tiled texture object.
index1D tile index. Flat indexing starts from bottom left tile, which is (0,0) in 2D.

Member Function Documentation

override Vector2 CalcSizeInPixels ( ) [virtual]

Based on the uv and texture dimensions, return the corresponding size in pixels.

For example you might want to do something like bob.Quad.S = bob.CalcSizeInPixels().

Implements SpriteBase.


Member Data Documentation

TileIndex2D defines the UV that will be used for this sprite.

Tiles are indexed in 2 dimensions.


Property Documentation

int TileIndex1D [get, set]

Instead of TileIndex2D you can also work with a flattened 1d index, for animation, etc.

In that case the set/get calculation depend on TextureInfo, so TextureInfo must have been set properly.