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

List of all members.

Public Member Functions

 SpriteManager2D ()
void SetNumLayersPriorities (int maxNumLayers, int maxNumPriorities)
void Update (int timePassed)
void RenderInOrder (Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
void RenderInOrder (Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Vector2 pos)
bool StoreSprite (Sprite2D sprite)
Sprite2D GetSprite (string ID)
bool DestroySprite (string ID)
void DisableAll ()
List< Sprite2DGetSprites ()
virtual void Clear ()
 SpriteManager2D ()
void SetNumLayersPriorities (int maxNumLayers, int maxNumPriorities)
void Update (int timePassed)
void RenderInOrder (Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
bool StoreSprite (Sprite2D sprite)
Sprite2D GetSprite (string ID)
virtual void Clear ()

Protected Attributes

List< Sprite2Dm_sprites
 Stores the sprites in the manager.
int m_maxNumLayers
 Maximum number of sprite layers.
int m_maxNumPriorities
 Maximum number of priorities that can be set in each layer.

Detailed Description

Stores, updates and renders 2D sprites. Sprites are displayed using the SpriteBatch method from xna. Sprites can be added, removed, and displayed in specific orders. Layers of sprites can be created, where sprites are displayed by layer, and inside the layer by the priority. A layer 0 would be displayed before layer 1. And priority 0 would be displayed before a priority 1 in the same layer.


Constructor & Destructor Documentation

Libraries.Sprites.SpriteManager2D.SpriteManager2D ( )

Default constructor.


Member Function Documentation

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

Clear the data stored in the object.

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

Clear the data stored in the object.

bool Libraries.Sprites.SpriteManager2D.DestroySprite ( string  ID)

Destroy the given sprite with the given ID. Clear will be called on the sprite.

ID - ID of the sprite to destroy.

Return:
Value is true if the sprite was destroyed, false if not.
void Libraries.Sprites.SpriteManager2D.DisableAll ( )

Mark all sprites in the manager as disabled.

Sprite2D Libraries.Sprites.SpriteManager2D.GetSprite ( string  ID)

Retrive the sprite with the matching ID, if a match exists.

ID - ID of the sprite to find.

Return:
Value is the sprite if a match was found, null if not.
Sprite2D Libraries.Sprites.SpriteManager2D.GetSprite ( string  ID)

Retrive the sprite with the matching ID, if a match exists.

sID - ID of the sprite to find.

Return:
Value is the sprite if a match was found, null if not.
List<Sprite2D> Libraries.Sprites.SpriteManager2D.GetSprites ( )

Create a list that contains all the sprites in the manager.

Return:
Value is the list that contains every sprite in the manager.

void Libraries.Sprites.SpriteManager2D.RenderInOrder ( Microsoft.Xna.Framework.Graphics.SpriteBatch  spriteBatch,
Microsoft.Xna.Framework.Vector2  pos 
)

Render the sprites. Sprites are rendered in the order they are stored. First in first rendered.

spriteBatch - Sprite batch to render the sprites with. Is assumed to be handled externally.
pos - Position to use for the sprites. Each sprite will have SetPos called with this position.
void Libraries.Sprites.SpriteManager2D.RenderInOrder ( Microsoft.Xna.Framework.Graphics.SpriteBatch  spriteBatch)

Render the sprites. Sprites are rendered in the order they are stored. First in first rendered.

spriteBatch - Sprite batch to render with. Is assumed to be handled externally.
void Libraries.Sprites.SpriteManager2D.RenderInOrder ( Microsoft.Xna.Framework.Graphics.SpriteBatch  spriteBatch)

Render the sprites. Sprites are rendered in the order they are stored. First in first rendered.

device - Device to render with.
void Libraries.Sprites.SpriteManager2D.SetNumLayersPriorities ( int  maxNumLayers,
int  maxNumPriorities 
)

Set the number of layers and priorities that the manager handles.

void Libraries.Sprites.SpriteManager2D.SetNumLayersPriorities ( int  maxNumLayers,
int  maxNumPriorities 
)

Set the number of layers and priorities that the manager handles.

maxNumLayers - Maximum number of layers that can be handled.
maxNumPriorities - Maximum number of priorities that can be handled in each layer.
bool Libraries.Sprites.SpriteManager2D.StoreSprite ( Sprite2D  sprite)

Store the given sprite, if possible. If the sprite has a ID, then the ID must be unique. If there is a ID that isn't unque in the manager, then the sprite won't be stored.

sprite - Sprite to store.

Return:
Value is true if the sprite is stored, false if not.
bool Libraries.Sprites.SpriteManager2D.StoreSprite ( Sprite2D  sprite)

Store the given sprite, if possible. If the sprite has a ID, then the ID must be unique. If there is a ID that isn't unque in the manager, then the sprite won't be stored.

sprite - Sprite to store.

Return:
Value is true if the sprite is stored, false if not.
void Libraries.Sprites.SpriteManager2D.Update ( int  timePassed)

Update the sprites.

timePassed - Value is how long the update is for.
void Libraries.Sprites.SpriteManager2D.Update ( int  timePassed)

Update the sprites.

timePassed - Value is how long the update is for.

Member Data Documentation

Maximum number of sprite layers.

Maximum number of priorities that can be set in each layer.

Stores the sprites in the manager.


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