Class Sprite
A Sprite is the core visual component
Inheritance
Implements
Inherited Members
Namespace: Inferno.Graphics
Assembly: Inferno.Desktop.dll
Syntax
public class Sprite : IDisposable
Constructors
| Improve this Doc View SourceSprite(Texture2D, Vector2)
Create a non-animated Sprite
Declaration
public Sprite(Texture2D texture, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Texture for the Sprite |
Vector2 | origin |
Sprite(Texture2D, Vector2, Int32, Int32, Single, Int32, Single)
Create an animated Sprite using a Sprite Sheet
Declaration
public Sprite(Texture2D texture, Vector2 origin, int frameWidth, int frameHeight, float imageSpeed = 30F, int startingFrame = 0, float rotation = 0F)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Sprite Sheet |
Vector2 | origin | |
System.Int32 | frameWidth | Frame Width |
System.Int32 | frameHeight | Frame Height |
System.Single | imageSpeed | Animation Speed (in secs) |
System.Int32 | startingFrame | Starting Frame (0 = first) |
System.Single | rotation | The rotation of the sprite |
Sprite(Texture2D[], Vector2, Int32, Int32, Single, Int32, Boolean, Single)
Create a Sprite using Texture Array
Declaration
public Sprite(Texture2D[] textures, Vector2 origin, int frameWidth, int frameHeight, float imageSpeed = 30F, int startingFrame = 0, bool spriteSheet = true, float rotation = 0F)
Parameters
Type | Name | Description |
---|---|---|
Texture2D[] | textures | Textures Array |
Vector2 | origin | The origin of the texture |
System.Int32 | frameWidth | Draw Width |
System.Int32 | frameHeight | Draw Height |
System.Single | imageSpeed | Image Speed (in frames) |
System.Int32 | startingFrame | Starting Frame (0 = first) |
System.Boolean | spriteSheet | Whether or not this is a sprite sheet |
System.Single | rotation | The rotation of the sprite |
Sprite(String, Vector2)
Declaration
public Sprite(string filename, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | |
Vector2 | origin |
Properties
| Improve this Doc View SourceFrameHeight
Declaration
public int FrameHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
FrameWidth
Declaration
public int FrameWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
FrameX
Declaration
public int FrameX { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FrameY
Declaration
public int FrameY { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Height
The Sprite draw Height
Declaration
public int Height { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ImageSpeed
The speed of the animation
Declaration
public float ImageSpeed { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
IsAnimated
Whether or not the texture is animated
Declaration
public bool IsAnimated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Origin
The sprite draw origin
Declaration
public Vector2 Origin { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Rotation
The rotation to draw at
Declaration
public float Rotation { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
SourceRectangle
Get the rectangle that will be drawn of the current texture
Declaration
public Rectangle SourceRectangle { get; }
Property Value
Type | Description |
---|---|
Rectangle |
SpriteSheet
Whether or not this is a sprite sheet (One texture with more than 1 sprite)
Declaration
public bool SpriteSheet { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Texture
Get the current texture
Declaration
public Texture2D Texture { get; }
Property Value
Type | Description |
---|---|
Texture2D |
Textures
The array of textures contained by the Sprite
Declaration
public Texture2D[] Textures { get; }
Property Value
Type | Description |
---|---|
Texture2D[] |
Width
The Sprite draw Width
Declaration
public int Width { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
FromColor(Color, Int32, Int32)
Create a sprite from a color
Declaration
public static Sprite FromColor(Color color, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color | color | |
System.Int32 | width | |
System.Int32 | height |
Returns
Type | Description |
---|---|
Sprite |
Update()
Update method for updating animation frames
Declaration
public void Update()