Game Development Reference
In-Depth Information
public class Sprite
{
internal const int VertexAmount = 6;
Vector[] _vertexPositions = new Vector[VertexAmount];
Color[] _vertexColors = new Color[VertexAmount];
Point[] _vertexUVs = new Point[VertexAmount];
Texture _texture = new Texture();
public Sprite()
{
InitVertexPositions(new Vector(0,0,0), 1, 1);
SetColor(new Color(1,1,1,1));
SetUVs(new Point(0, 0), new Point(1, 1));
}
public Texture Texture
{
get { return _texture; }
set
{
_texture = value;
// By default the width and height is set
// to that of the texture
InitVertexPositions(GetCenter(), _texture.Width, _texture.
Height);
}
}
public Vector[] VertexPositions
{
get { return _vertexPositions; }
}
public Color[] VertexColors
{
get { return _vertexColors; }
}
public Point[] VertexUVs
{
get { return _vertexUVs; }
}
Search WWH ::




Custom Search