Class SpriteSheet
A collection of sprites sliced from a larger texture
public class SpriteSheet
- Inheritance
-
SpriteSheet
- Inherited Members
Constructors
SpriteSheet(Texture2D, Point)
Initializes a new instance of the SpriteSheet from the given Microsoft.Xna.Framework.Graphics.Texture2D.
public SpriteSheet(Texture2D texture, Point size)
Parameters
textureTexture2DThe Microsoft.Xna.Framework.Graphics.Texture2D that will be sliced.
sizePointThe size of a single sprite in the sheet.
SpriteSheet(Texture2D, int)
public SpriteSheet(Texture2D texture, int size)
Parameters
textureTexture2DsizeintThe size of a single sprite in the sheet.
SpriteSheet(Texture2D, int, int[])
public SpriteSheet(Texture2D texture, int size, int[] indices)
Parameters
textureTexture2DsizeintThe size of a single sprite in the sheet.
indicesint[]The indices to keep from the sliced sheet.
Properties
Count
Gets the total number of sprites in this sheet.
public int Count { get; }
Property Value
this[int]
Gets the sprite Microsoft.Xna.Framework.Graphics.Texture2D at the given index.
public Texture2D this[int index] { get; }
Parameters
indexintThe index of the sprite.
Property Value
- Texture2D
The sprite Microsoft.Xna.Framework.Graphics.Texture2D.
Exceptions
- IndexOutOfRangeException
Thrown if the index is invalid.
Methods
Get(int)
Gets the sprite Microsoft.Xna.Framework.Graphics.Texture2D at the given index.
public Texture2D Get(int index)
Parameters
indexintThe index of the sprite.
Returns
- Texture2D
The sprite Microsoft.Xna.Framework.Graphics.Texture2D.
Exceptions
- IndexOutOfRangeException
Thrown if the index is invalid.