C#Code
C#Code
Public Member Functions | Protected Attributes
Libraries.Sprites.Sprite2D Class Reference

List of all members.

Public Member Functions

 Sprite2D ()
void SetLayer (int layer)
void SetOrder (int order)
void SetTexure (Texture2D texture)
void SetPos (Vector2 pos)
void SetScale (Vector2 scale)
void SetFlipX (bool flip)
void SetFlipY (bool flip)
void SetFlip (bool flipX, bool flipY)
void SetTexSourceRect (Rectangle rect)
void SetUseTexSourceRect (bool useRect)
void SetTint (Color tint)
void SetRotation (float rot)
void SetOrigin (Vector2 origin)
void SetEnabled (bool enabled)
bool GetEnabled ()
void SetID (string ID)
void StoreProperty (BaseSpriteProperty prop)
int GetLayer ()
int GetOrder (int order)
Texture2D GetTexure ()
Vector2 GetPos ()
Vector2 GetScale ()
bool GetFlipX (bool flip)
bool GetFlipY ()
Rectangle GetTexSourceRect ()
bool GetUseTexSourceRect ()
Color GetTint (Color tint)
float GetRotation ()
Vector2 GetOrigin ()
void Update (int timePassed)
void Render (SpriteBatch spriteBatch)
string GetID ()
SpriteDisplay GetStandardProperties ()
BaseSpriteProperty GetPropertyByID (string ID)
BaseSpriteProperty GetPropertyByType (string type)
virtual void Clear ()
void SetAlpha (int alpha)
virtual bool CheckPointOnSprite (Microsoft.Xna.Framework.Vector2 point, bool checkForTransparency)
 Sprite2D ()
void SetLayer (int layer)
void SetOrder (int order)
void SetTexure (Texture2D texture)
void SetPos (Vector2 pos)
void SetScale (Vector2 scale)
void SetFlipX (bool flip)
void SetFlipY (bool flip)
void SetFlip (bool flipX, bool flipY)
void SetTexSourceRect (Rectangle rect)
void SetUseTexSourceRect (bool useRect)
void SetTint (Color tint)
void SetRotation (float rot)
void SetOrigin (Vector2 origin)
void SetID (string ID)
void StoreProperty (BaseSpriteProperty prop)
int GetLayer ()
int GetOrder (int order)
Texture2D GetTexure ()
Vector2 GetPos ()
Vector2 GetScale ()
bool GetFlipX (bool flip)
bool GetFlipY ()
Rectangle GetTexSourceRect ()
bool GetUseTexSourceRect ()
Color GetTint (Color tint)
float GetRotation ()
Vector2 GetOrigin ()
void Update (int timePassed)
void Render (SpriteBatch spriteBatch)
string GetID ()
SpriteDisplay GetStandardProperties ()
BaseSpriteProperty GetPropertyByID (string ID)
BaseSpriteProperty GetPropertyByType (string type)
virtual void Clear ()

Protected Attributes

int m_layer
 Display layer the sprite is on. Value should be -1 if not on a layer.
int m_order
 Display order in the layer the sprite is on. Value should be -1 if not in any particular order.
Texture2D m_texture
 Texture to use for the sprite.
Vector2 m_spritePos
 Sprite position, in pixels.
string m_ID
 String that represents the sprite. Value is null if the sprite is unnamed.
SpriteDisplay m_standardProps
 Standards properties that all sprites have access to.
SpriteProperties m_properties
 Non-standard sprite properties. Add the properties you want.

Detailed Description

2D sprite used with a SpriteBatch object to display sprites. Contains whatever is needed to display the sprite with a SpriteBatch.


Constructor & Destructor Documentation

Libraries.Sprites.Sprite2D.Sprite2D ( )

Default constructor.

Libraries.Sprites.Sprite2D.Sprite2D ( )

Default constructor.


Member Function Documentation

virtual bool Libraries.Sprites.Sprite2D.CheckPointOnSprite ( Microsoft.Xna.Framework.Vector2  point,
bool  checkForTransparency 
) [virtual]

Check if a given point would be on the sprite. Does not currently handle if the sprite is scaled, flipped or rotated.

point - Position to check for in the sprite.
checkForTransparency - True if transparenet pixels should also be checked, false if just non-transparent.

Return:
Value is true if the point was on the sprite, false if not.
virtual void Libraries.Sprites.Sprite2D.Clear ( ) [virtual]

Clear the data objects stored in the object.

virtual void Libraries.Sprites.Sprite2D.Clear ( ) [virtual]

Clear the data objects stored in the object.

bool Libraries.Sprites.Sprite2D.GetEnabled ( )

Get whether the sprite is enabled. A disabled sprite should never update or render.

Return:
Value is true if the sprite is enabled, false if disabled.

bool Libraries.Sprites.Sprite2D.GetFlipX ( bool  flip)

Get whether the horizontal flip should be applied to the sprite.



Return:
True if it should be flipped, false if not.
bool Libraries.Sprites.Sprite2D.GetFlipX ( bool  flip)

Get whether the horizontal flip should be applied to the sprite.



Return:
True if it should be flipped, false if not.
bool Libraries.Sprites.Sprite2D.GetFlipY ( )

Get whether the vertical flip should be applied to the sprite.



Return:
True if it should be flipped, false if not.
bool Libraries.Sprites.Sprite2D.GetFlipY ( )

Get whether the vertical flip should be applied to the sprite.



Return:
True if it should be flipped, false if not.
string Libraries.Sprites.Sprite2D.GetID ( )

Retrive the ID asssociated with the sprite. The string is the actual ID stored in the sprite, so don't change it unless you really need to.

Return:
Value is the ID of the sprite if it has a ID set, null if not.

string Libraries.Sprites.Sprite2D.GetID ( )

Retrive the ID asssociated with the sprite. The string is the actual ID stored in the sprite, so don't change it unless you really need to.

Return:
Value is the ID of the sprite if it has a ID set, null if not.

int Libraries.Sprites.Sprite2D.GetLayer ( )

Get the layer the sprite is on

Return:
Value is the layer the sprite is on.

int Libraries.Sprites.Sprite2D.GetLayer ( )

Get the layer the sprite is on

Return:
Value is the layer the sprite is on.

int Libraries.Sprites.Sprite2D.GetOrder ( int  order)

Get the display order the sprite is at

Value is the order the sprite is at.

int Libraries.Sprites.Sprite2D.GetOrder ( int  order)

Get the display order the sprite is at

Value is the order the sprite is at.

Vector2 Libraries.Sprites.Sprite2D.GetOrigin ( )

Get where on the texture is considered the origin. (0, 0) would be the top left.

Return:
Value is the origin used for the texture.

Vector2 Libraries.Sprites.Sprite2D.GetOrigin ( )

Get where on the texture is considered the origin. (0, 0) would be the top left.

Return:
Value is the origin used for the texture.

Vector2 Libraries.Sprites.Sprite2D.GetPos ( )

Get the sprite position, in pixels.

Return:
Value is the position the sprite is at.

Vector2 Libraries.Sprites.Sprite2D.GetPos ( )

Get the sprite position, in pixels.

Return:
Value is the position the sprite is at.

BaseSpriteProperty Libraries.Sprites.Sprite2D.GetPropertyByID ( string  ID)

Retrive the stored sprite property that matches the ID, if one exists.

ID - ID of the property to retrive.

Return:
Value is the property that has a ID matching the given ID, null if no match was found.
BaseSpriteProperty Libraries.Sprites.Sprite2D.GetPropertyByID ( string  ID)

Retrive the stored sprite property that matches the ID, if one exists.

ID - ID of the property to retrive.

Return:
Value is the property that has a ID matching the given ID, null if no match was found.
BaseSpriteProperty Libraries.Sprites.Sprite2D.GetPropertyByType ( string  type)

Retrive the stored sprite property that matches the given property type, if one exists.

type - type of the property to retrive.

Return:
Value is the first instance found matching the given type, null if no match was found.
BaseSpriteProperty Libraries.Sprites.Sprite2D.GetPropertyByType ( string  type)

Retrive the stored sprite property that matches the given property type, if one exists.

type - type of the property to retrive.

Return:
Value is the first instance found matching the given type, null if no match was found.
float Libraries.Sprites.Sprite2D.GetRotation ( )

Get the rotation to use for the sprite.



Return:
Rotation to apply to the sprite. Value is in radians (2*PI == 360 degrees)
float Libraries.Sprites.Sprite2D.GetRotation ( )

Get the rotation to use for the sprite.



Return:
Rotation to apply to the sprite. Value is in radians (2*PI == 360 degrees)
Vector2 Libraries.Sprites.Sprite2D.GetScale ( )

Get the scale to applied to the sprite.

scale - scale to apply.
Vector2 Libraries.Sprites.Sprite2D.GetScale ( )

Get the scale to applied to the sprite.

scale - scale to apply.
SpriteDisplay Libraries.Sprites.Sprite2D.GetStandardProperties ( )

Retrive the standard sprite properties.

Return:
Value is the standard sprite properties object stored in the sprite.

SpriteDisplay Libraries.Sprites.Sprite2D.GetStandardProperties ( )

Retrive the standard sprite properties.

Return:
Value is the standard sprite properties object stored in the sprite.

Rectangle Libraries.Sprites.Sprite2D.GetTexSourceRect ( )

Get where on the texture is used for the sprite.

Return:
Where on the texture to use when displaying the sprite. Values are in pixels.

Rectangle Libraries.Sprites.Sprite2D.GetTexSourceRect ( )

Get where on the texture is used for the sprite.

Return:
Where on the texture to use when displaying the sprite. Values are in pixels.

Texture2D Libraries.Sprites.Sprite2D.GetTexure ( )

Get the texture the sprite uses.

Return:
Value is the texture the sprite is currently using.

Texture2D Libraries.Sprites.Sprite2D.GetTexure ( )

Get the texture the sprite uses.

Return:
Value is the texture the sprite is currently using.

Color Libraries.Sprites.Sprite2D.GetTint ( Color  tint)

Get the color tinting to apply to the sprite.

Return:
Value is the tint color used by the sprite.

Color Libraries.Sprites.Sprite2D.GetTint ( Color  tint)

Get the color tinting to apply to the sprite.

Return:
Value is the tint color used by the sprite.

bool Libraries.Sprites.Sprite2D.GetUseTexSourceRect ( )

Get whether the sprite uses the source rect portion of the texture or the entire thing.

Return:
Value is true if only the part of the texture specified by the source rect should be used, false if the entire thing.

bool Libraries.Sprites.Sprite2D.GetUseTexSourceRect ( )

Get whether the sprite uses the source rect portion of the texture or the entire thing.

Return:
Value is true if only the part of the texture specified by the source rect should be used, false if the entire thing.

void Libraries.Sprites.Sprite2D.Render ( SpriteBatch  spriteBatch)

Display the sprite with its properties.

spriteBatch - Sprite batch to display the sprite with.
void Libraries.Sprites.Sprite2D.Render ( SpriteBatch  spriteBatch)

Display the sprite with its properties.

spriteBatch - Sprite batch to display the sprite with.
void Libraries.Sprites.Sprite2D.SetAlpha ( int  alpha)

Set the alpha component to use. Remember alpha must be set in the spritebatch begin function with something like BlendState.NonPremultiplied for alpha to show up. Alpha is kept in the range [0, 255].

void Libraries.Sprites.Sprite2D.SetEnabled ( bool  enabled)

Set whether the sprite is enabled. A disabled sprite should never update or render.

enabled - True if the sprite should be enabled, false if disabled.
void Libraries.Sprites.Sprite2D.SetFlip ( bool  flipX,
bool  flipY 
)

Set whether the vertical flip should be applied to the sprite.

flipX - True for horizonal flipping.
flipY - True for vertical flipping.
void Libraries.Sprites.Sprite2D.SetFlip ( bool  flipX,
bool  flipY 
)

Set whether the vertical flip should be applied to the sprite.

flipX - True for horizonal flipping.
flipY - True for vertical flipping.
void Libraries.Sprites.Sprite2D.SetFlipX ( bool  flip)

Set whether the horizontal flip should be applied to the sprite.

flip - True if it should be flipped, false if not.
void Libraries.Sprites.Sprite2D.SetFlipX ( bool  flip)

Set whether the horizontal flip should be applied to the sprite.

flip - True if it should be flipped, false if not.
void Libraries.Sprites.Sprite2D.SetFlipY ( bool  flip)

Set whether the vertical flip should be applied to the sprite.

flip - True if it should be flipped, false if not.
void Libraries.Sprites.Sprite2D.SetFlipY ( bool  flip)

Set whether the vertical flip should be applied to the sprite.

flip - True if it should be flipped, false if not.
void Libraries.Sprites.Sprite2D.SetID ( string  ID)

Set the ID that represents the ID. Can be null to make the sprite unnamed.

ID - ID to use for the sprite.
void Libraries.Sprites.Sprite2D.SetID ( string  ID)

Set the ID that represents the ID. Can be null to make the sprite unnamed.

ID - ID to use for the sprite.
void Libraries.Sprites.Sprite2D.SetLayer ( int  layer)

Set the layer the sprite should be on.

layer - Display layer the sprite is on.
void Libraries.Sprites.Sprite2D.SetLayer ( int  layer)

Set the layer the sprite should be on.

layer - Display layer the sprite is on.
void Libraries.Sprites.Sprite2D.SetOrder ( int  order)

Set the display order the sprite should be at.

order - Display order the sprite is at.
void Libraries.Sprites.Sprite2D.SetOrder ( int  order)

Set the display order the sprite should be at.

order - Display order the sprite is at.
void Libraries.Sprites.Sprite2D.SetOrigin ( Vector2  origin)

Set where on the texture is considered the origin. (0, 0) would be the top left.

void Libraries.Sprites.Sprite2D.SetOrigin ( Vector2  origin)

Set where on the texture is considered the origin. (0, 0) would be the top left.

origin - Origin to use for the sprite.
void Libraries.Sprites.Sprite2D.SetPos ( Vector2  pos)

Set the sprite position to the given position.

pos - Sprite position to use. Value should be in pixels.
void Libraries.Sprites.Sprite2D.SetPos ( Vector2  pos)

Set the sprite position to the given position.

pos - Sprite position to use. Value should be in pixels.
void Libraries.Sprites.Sprite2D.SetRotation ( float  rot)

Set the rotation to use for the sprite.

rot - Rotation to apply. Value is in radians (2*PI == 360 degrees)
void Libraries.Sprites.Sprite2D.SetRotation ( float  rot)

Set the rotation to use for the sprite.

rot - Rotation to apply. Value is in radians (2*PI == 360 degrees)
void Libraries.Sprites.Sprite2D.SetScale ( Vector2  scale)

Set the scale to apply to the sprite.

scale - scale to apply.
void Libraries.Sprites.Sprite2D.SetScale ( Vector2  scale)

Set the scale to apply to the sprite.

scale - scale to apply.
void Libraries.Sprites.Sprite2D.SetTexSourceRect ( Rectangle  rect)

Set where on the texture is used for the sprite.

rect - Where on the texture to use when displaying the sprite. Values are in pixels.
void Libraries.Sprites.Sprite2D.SetTexSourceRect ( Rectangle  rect)

Set where on the texture is used for the sprite.

rect - Where on the texture to use when displaying the sprite. Values are in pixels.
void Libraries.Sprites.Sprite2D.SetTexure ( Texture2D  texture)

Set the texture the sprite uses.

texture - Texture to use. Gets stored in the model.
void Libraries.Sprites.Sprite2D.SetTexure ( Texture2D  texture)

Set the texture the sprite uses.

texture - Texture to use. Gets stored in the model.
void Libraries.Sprites.Sprite2D.SetTint ( Color  tint)

Set the color tinting to apply to the sprite.

tint - Tint to use. Value should be Color.White for no tinting.
void Libraries.Sprites.Sprite2D.SetTint ( Color  tint)

Set the color tinting to apply to the sprite.

tint - Tint to use. Value should be Color.White for no tinting.
void Libraries.Sprites.Sprite2D.SetUseTexSourceRect ( bool  useRect)

Set whether the sprite uses the source rect portion of the texture or the entire thing.

useRect - Value is true if only the part of the texture specified by the source rect should be used, false if the entire thing.
void Libraries.Sprites.Sprite2D.SetUseTexSourceRect ( bool  useRect)

Set whether the sprite uses the source rect portion of the texture or the entire thing.

useRect - Value is true if only the part of the texture specified by the source rect should be used, false if the entire thing.
void Libraries.Sprites.Sprite2D.StoreProperty ( BaseSpriteProperty  prop)

Store the given sprite property.

prop - Property to store.
void Libraries.Sprites.Sprite2D.StoreProperty ( BaseSpriteProperty  prop)

Store the given sprite property.

prop - Property to store.
void Libraries.Sprites.Sprite2D.Update ( int  timePassed)

Update the sprite. Updates any properties in the sprite as well.

timePassed - How long the update is for. Value is in milliseconds.
void Libraries.Sprites.Sprite2D.Update ( int  timePassed)

Update the sprite. Updates any properties in the sprite as well.

timePassed - How long the update is for. Value is in milliseconds.

Member Data Documentation

String that represents the sprite. Value is null if the sprite is unnamed.

Display layer the sprite is on. Value should be -1 if not on a layer.

Display order in the layer the sprite is on. Value should be -1 if not in any particular order.

Non-standard sprite properties. Add the properties you want.

Sprite position, in pixels.

Standards properties that all sprites have access to.

Texture to use for the sprite.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Properties