Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Paradox.Graphics.Sprite Class Reference

A sprite represents a series frames in an atlas forming an animation. More...

Inheritance diagram for SiliconStudio.Paradox.Graphics.Sprite:
SiliconStudio.Paradox.Graphics.ImageFragment

Public Member Functions

 Sprite ()
 Creates a new instance of sprite with unique random name. More...
 
 Sprite (string fragmentName)
 Create a new instance of sprite. More...
 
void Draw (SpriteBatch spriteBatch, Vector2 position, float rotation=0, float depthLayer=0, SpriteEffects spriteEffects=SpriteEffects.None)
 Draw a specific frame of the sprite with white color and scale of 1. More...
 
void Draw (SpriteBatch spriteBatch, Vector2 position, Color color, Vector2 scales, float rotation=0f, float depthLayer=0, SpriteEffects spriteEffects=SpriteEffects.None)
 Draw a specific frame of the sprite. More...
 
Sprite Clone ()
 Clone the current sprite. More...
 
- Public Member Functions inherited from SiliconStudio.Paradox.Graphics.ImageFragment
 ImageFragment (string fragmentName)
 Creates an empty image fragment having the provided name. More...
 
 ImageFragment (string fragmentName, Texture2D color, Texture2D alpha)
 Creates a image fragment having the provided color/alpha textures and name. The region size is initialized with the whole size of the texture. More...
 
override string ToString ()
 

Public Attributes

Vector2 Center
 The position of the center of the image in pixels. More...
 

Additional Inherited Members

- Properties inherited from SiliconStudio.Paradox.Graphics.ImageFragment
string Name [get, set]
 Gets or sets the name of the image fragment. More...
 
Texture2D Texture [get, set]
 The texture in which the image is contained More...
 
Texture2D TextureAlpha [get, set]
 The texture in which the image alpha is contained More...
 
virtual bool SubstituteAlpha [get]
 Gets a value indicating if the alpha component of the ImageFragment should be taken from the color of the TextureAlpha texture or not. More...
 
virtual RectangleF Region [get, set]
 The rectangle specifying the region of the texture to use as fragment. More...
 
bool IsTransparent [get, set]
 Gets or sets the value indicating if the fragment contains transparent regions. More...
 
virtual ImageOrientation Orientation [get, set]
 Gets or sets the rotation to apply to the texture region when rendering the ImageFragment More...
 

Detailed Description

A sprite represents a series frames in an atlas forming an animation.

Definition at line 14 of file Sprite.cs.

Constructor & Destructor Documentation

SiliconStudio.Paradox.Graphics.Sprite.Sprite ( )

Creates a new instance of sprite with unique random name.

Definition at line 19 of file Sprite.cs.

SiliconStudio.Paradox.Graphics.Sprite.Sprite ( string  fragmentName)

Create a new instance of sprite.

Parameters
fragmentNamethe sprite name

Definition at line 28 of file Sprite.cs.

Member Function Documentation

Sprite SiliconStudio.Paradox.Graphics.Sprite.Clone ( )

Clone the current sprite.

Returns
A new instance of the current sprite.

Definition at line 84 of file Sprite.cs.

void SiliconStudio.Paradox.Graphics.Sprite.Draw ( SpriteBatch  spriteBatch,
Vector2  position,
float  rotation = 0,
float  depthLayer = 0,
SpriteEffects  spriteEffects = SpriteEffects.None 
)

Draw a specific frame of the sprite with white color and scale of 1.

Parameters
spriteBatchThe sprite batch used to draw the sprite.
positionThe position to which draw the sprite
rotationThe rotation to apply on the sprite
depthLayerThe depth layer to which draw the sprite
spriteEffectsThe sprite effect to apply on the sprite

This function must be called between the SpriteBatch.Begin(SiliconStudio.Paradox.Graphics.SpriteSortMode,SiliconStudio.Paradox.Graphics.Effect) and SpriteBatch.End() calls of the provided spriteBatch

Exceptions
ArgumentExceptionThe provided frame index is not valid.
ArgumentOutOfRangeExceptionThe provided spriteBatch is null

Definition at line 51 of file Sprite.cs.

References SiliconStudio.Core.Mathematics.Vector2.One, and SiliconStudio.Core.Mathematics.Color.White.

void SiliconStudio.Paradox.Graphics.Sprite.Draw ( SpriteBatch  spriteBatch,
Vector2  position,
Color  color,
Vector2  scales,
float  rotation = 0f,
float  depthLayer = 0,
SpriteEffects  spriteEffects = SpriteEffects.None 
)

Draw a specific frame of the sprite.

Parameters
spriteBatchThe sprite batch used to draw the sprite.
positionThe position to which draw the sprite
colorThe color to use to draw the sprite
rotationThe rotation to apply on the sprite
scalesThe scale factors to apply on the sprite
depthLayerThe depth layer to which draw the sprite
spriteEffectsThe sprite effect to apply on the sprite

This function must be called between the SpriteBatch.Begin(SiliconStudio.Paradox.Graphics.SpriteSortMode,SiliconStudio.Paradox.Graphics.Effect) and SpriteBatch.End() calls of the provided spriteBatch

Exceptions
ArgumentExceptionThe provided frame index is not valid.
ArgumentOutOfRangeExceptionThe provided spriteBatch is null

Definition at line 70 of file Sprite.cs.

References SiliconStudio.Paradox.Graphics.Center.

Member Data Documentation

Vector2 SiliconStudio.Paradox.Graphics.Sprite.Center

The position of the center of the image in pixels.

Definition at line 37 of file Sprite.cs.


The documentation for this class was generated from the following file: