• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Inferno
    • CollisionMode
    • DrawMode
    • Game
    • Game.OnResizeEventArgs
    • GameState
    • GameState.StateOnDrawEventArgs
    • GameWindow
    • Instance
    • MathHelper
    • Matrix
    • Point
    • Rectangle
    • Settings
    • SpatialMode
    • UpdateMode
    • Vector2
    • Vector3
    • Vector4
  • Inferno.Audio
    • AudioDevice
    • Sound
  • Inferno.Content
    • ContentLoader
  • Inferno.Formats.Audio
    • WaveFormat
  • Inferno.Formats.Graphics.Text
    • FontFormat
  • Inferno.Graphics
    • Camera
    • Color
    • GraphicsDevice
    • PlatformType
    • Renderable
    • RenderableType
    • Renderer
    • RenderSortMode
    • RenderTarget
    • Shader
    • ShaderLanguage
    • ShaderType
    • Sprite
    • Texture2D
    • Tileset
  • Inferno.Graphics.Text
    • Font
    • FontBuilder
  • Inferno.Input
    • ButtonState
    • Key
    • Keyboard
    • Keyboard.KeyEventArgs
    • KeyboardState
    • KeyState
    • Mouse
    • MouseState
  • Inferno.Tiled
    • RenderOrder
    • TiledLayer
    • TiledLayerChunk
    • TiledLoader
    • TiledMap
    • TiledMapOrientation
    • TiledObject
    • TiledObjectLayer
    • TiledVersion
  • Inferno.UI
    • MessageBox
    • MessageBoxType
    • UserInterface
  • Inferno.UI.Controls
    • Button
    • Control
    • Control.ControlClickedEvent
    • Control.ControlHoveredEvent
    • Control.TextChangedEventArgs
    • ControlState
    • Cursor
    • Label

Class Sprite

A Sprite is the core visual component

Inheritance
System.Object
Sprite
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Inferno.Graphics
Assembly: Inferno.Desktop.dll
Syntax
public class Sprite : IDisposable

Constructors

| Improve this Doc View Source

Sprite(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
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

Sprite(String, Vector2)

Declaration
public Sprite(string filename, Vector2 origin)
Parameters
Type Name Description
System.String filename
Vector2 origin

Properties

| Improve this Doc View Source

FrameHeight

Declaration
public int FrameHeight { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

FrameWidth

Declaration
public int FrameWidth { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

FrameX

Declaration
public int FrameX { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

FrameY

Declaration
public int FrameY { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Height

The Sprite draw Height

Declaration
public int Height { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

ImageSpeed

The speed of the animation

Declaration
public float ImageSpeed { get; set; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

IsAnimated

Whether or not the texture is animated

Declaration
public bool IsAnimated { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Origin

The sprite draw origin

Declaration
public Vector2 Origin { get; set; }
Property Value
Type Description
Vector2
| Improve this Doc View Source

Rotation

The rotation to draw at

Declaration
public float Rotation { get; set; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

SourceRectangle

Get the rectangle that will be drawn of the current texture

Declaration
public Rectangle SourceRectangle { get; }
Property Value
Type Description
Rectangle
| Improve this Doc View Source

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
| Improve this Doc View Source

Texture

Get the current texture

Declaration
public Texture2D Texture { get; }
Property Value
Type Description
Texture2D
| Improve this Doc View Source

Textures

The array of textures contained by the Sprite

Declaration
public Texture2D[] Textures { get; }
Property Value
Type Description
Texture2D[]
| Improve this Doc View Source

Width

The Sprite draw Width

Declaration
public int Width { get; set; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

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
| Improve this Doc View Source

Update()

Update method for updating animation frames

Declaration
public void Update()

Implements

System.IDisposable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX