C# Class SGDE.Graphics.Sprite

A drawable sprite object that can be displayed on screen.
Inheritance: SceneNode, IDrawable
Exibir arquivo Open project: sgdc/sgdc-old

Protected Properties

Property Type Description
overrideAtt SpriteAttributes

Private Properties

Property Type Description
AdjustOrderTranslation void
CopySpriteToIn void
SetAnimation void

Public Methods

Method Description
Draw ( GameTime gameTime ) : void

Draw this Sprite.

GetAnimationEffect ( ) : SpriteEffects

Get animation effect for the current frame of animation.

GetAnimationFrame ( ) : Rectangle?

Get animation frame, if it exists, for the current frame of animation.

GetAnimationOrigin ( ) : Vector2?

Get animation origin, if it exists, for the current frame of animation.

GetAnimationRotation ( ) : float?

Get animation rotation, if it exists, for the current frame of animation.

GetAnimationScale ( ) : Vector2?

Get animation scale, if it exists, for the current frame of animation.

GetAnimationTint ( ) : Color?

Get animation tint, if it exists, for the current frame of animation.

OverrideAnimation ( SpriteAttributes component, bool allowed ) : bool

Some attributes about a Sprite can be determined by it's animation. This function allows the determination of what attributes are allowed to be set by the animation and what are user determined.

SetAnimation ( int id ) : bool

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.

SetAnimation ( int id, bool checkGlobal ) : bool

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.

SetAnimation ( int id, bool checkGlobal, bool global ) : bool

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.

SetAnimation ( string gameElement ) : bool

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.

Update ( GameTime gameTime ) : void

Update this Sprite.

Protected Methods

Method Description
CopySpriteTo ( Sprite &sp, bool full ) : void

Copy this Sprite to another Sprite.

Sprite ( ) : System

Create a new Sprite with default values.

Private Methods

Method Description
AdjustOrderTranslation ( ) : void
CopySpriteToIn ( Sprite &sp, bool full ) : void
SetAnimation ( SpriteManager ani ) : void

Method Details

CopySpriteTo() protected abstract method

Copy this Sprite to another Sprite.
protected abstract CopySpriteTo ( Sprite &sp, bool full ) : void
sp Sprite The Sprite to copy to.
full bool true if the entire Sprite should be copied, false if only changes should get copied.
return void

Draw() public abstract method

Draw this Sprite.
public abstract Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The GameTime since the last draw.
return void

GetAnimationEffect() public method

Get animation effect for the current frame of animation.
public GetAnimationEffect ( ) : SpriteEffects
return SpriteEffects

GetAnimationFrame() public method

Get animation frame, if it exists, for the current frame of animation.
public GetAnimationFrame ( ) : Rectangle?
return Rectangle?

GetAnimationOrigin() public method

Get animation origin, if it exists, for the current frame of animation.
public GetAnimationOrigin ( ) : Vector2?
return Vector2?

GetAnimationRotation() public method

Get animation rotation, if it exists, for the current frame of animation.
public GetAnimationRotation ( ) : float?
return float?

GetAnimationScale() public method

Get animation scale, if it exists, for the current frame of animation.
public GetAnimationScale ( ) : Vector2?
return Vector2?

GetAnimationTint() public method

Get animation tint, if it exists, for the current frame of animation.
public GetAnimationTint ( ) : Color?
return Color?

OverrideAnimation() public method

Some attributes about a Sprite can be determined by it's animation. This function allows the determination of what attributes are allowed to be set by the animation and what are user determined.
public OverrideAnimation ( SpriteAttributes component, bool allowed ) : bool
component SpriteAttributes What component of the Sprite should be get/set.
allowed bool true if this compoennt can be overriden by the Sprite's animation, false is otherwise. Can also be set to null if the value should be returned.
return bool

SetAnimation() public method

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.
public SetAnimation ( int id ) : bool
id int The ID of the animation. This is the ID used locally by the Sprite.
return bool

SetAnimation() public method

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.
public SetAnimation ( int id, bool checkGlobal ) : bool
id int The ID of the animation. This is the ID used locally by the Sprite, if the ID could identify global animations then the ID can identify a global animation ID.
checkGlobal bool If global animation should be checked if Sprite specific animation is not found.
return bool

SetAnimation() public method

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.
public SetAnimation ( int id, bool checkGlobal, bool global ) : bool
id int The ID of the animation. This is the ID used locally by the Sprite, if the ID could identify global animations then the ID can identify a global animation ID.
checkGlobal bool If global animation should be checked if Sprite specific animation is not found.
global bool If global animation should be checked before Sprite specific animation. If this is true than is ignored.
return bool

SetAnimation() public method

Set the animation for the Sprite. IMPORTANT: If the animation is successfully set then the FPS, current frame of animation, and animation region are reset to the default values of the animation.
public SetAnimation ( string gameElement ) : bool
gameElement string The Asset ID of the animation.
return bool

Sprite() protected method

Create a new Sprite with default values.
protected Sprite ( ) : System
return System

Update() public method

Update this Sprite.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The GameTime since the last update.
return void

Property Details

overrideAtt protected_oe property

The current SpriteAttributes that can override the Sprite's default attributes.
protected SpriteAttributes overrideAtt
return SpriteAttributes