C# Class Category5.Animation

Show file Open project: AnyKey/tojam4 Class Usage Examples

Protected Properties

Property Type Description
color Color
currentFrame int
frameCount int
frameHeight int
frameWidth int
lastAnimTime float
texture Microsoft.Xna.Framework.Graphics.Texture2D
timeBetweenFrames float

Public Methods

Method Description
Animation ( Microsoft.Xna.Framework.Graphics.Texture2D aTexture, int fWidth, int fHeight, float animTime ) : System

Constructor to assign values to all fields

Copy ( ) : Animation
Draw ( SpriteBatch sBatch, Rectangle dest, double direction ) : void

Draw a frame of the animation to the screen at the given location. dest specifies the rectangle to be filled by the frame Direction value orients the frame, and is given in radians

Draw ( SpriteBatch sBatch, Rectangle2D dest, double direction ) : void

Draw a frame of the animation to the screen at the given location. dest specifies the rectangle to be filled by the frame Direction value orients the frame, and is given in radians

Draw ( SpriteBatch sBatch, Vector2 location, double direction ) : void

Draw a frame of the animation to the screen at the given location. Location specifies the CENTER of the frame Direction value orients the frame, and is given in radians

FastDraw ( SpriteBatch sBatch, Rectangle dest ) : void

Draw a frame of the animation to the screen at given location by rectangle bounds without rotation

Update ( float elapsedTime ) : void
resetColor ( ) : void

Reset the color of the animation to what is was originally

setColor ( Color newColor ) : void

Changes the color of the animation permanently

setCurrentFrame ( int newFrame ) : void

Sets the current frame of the animation Frame numbers start at 0 and go to frameCount - 1

Private Methods

Method Description
nextFrame ( ) : void

Method Details

Animation() public method

Constructor to assign values to all fields
public Animation ( Microsoft.Xna.Framework.Graphics.Texture2D aTexture, int fWidth, int fHeight, float animTime ) : System
aTexture Microsoft.Xna.Framework.Graphics.Texture2D
fWidth int
fHeight int
animTime float
return System

Copy() public method

public Copy ( ) : Animation
return Animation

Draw() public method

Draw a frame of the animation to the screen at the given location. dest specifies the rectangle to be filled by the frame Direction value orients the frame, and is given in radians
public Draw ( SpriteBatch sBatch, Rectangle dest, double direction ) : void
sBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
dest Microsoft.Xna.Framework.Rectangle
direction double
return void

Draw() public method

Draw a frame of the animation to the screen at the given location. dest specifies the rectangle to be filled by the frame Direction value orients the frame, and is given in radians
public Draw ( SpriteBatch sBatch, Rectangle2D dest, double direction ) : void
sBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
dest Rectangle2D
direction double
return void

Draw() public method

Draw a frame of the animation to the screen at the given location. Location specifies the CENTER of the frame Direction value orients the frame, and is given in radians
public Draw ( SpriteBatch sBatch, Vector2 location, double direction ) : void
sBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
location Vector2
direction double
return void

FastDraw() public method

Draw a frame of the animation to the screen at given location by rectangle bounds without rotation
public FastDraw ( SpriteBatch sBatch, Rectangle dest ) : void
sBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
dest Microsoft.Xna.Framework.Rectangle
return void

Update() public method

public Update ( float elapsedTime ) : void
elapsedTime float
return void

resetColor() public method

Reset the color of the animation to what is was originally
public resetColor ( ) : void
return void

setColor() public method

Changes the color of the animation permanently
public setColor ( Color newColor ) : void
newColor Color
return void

setCurrentFrame() public method

Sets the current frame of the animation Frame numbers start at 0 and go to frameCount - 1
public setCurrentFrame ( int newFrame ) : void
newFrame int
return void

Property Details

color protected property

protected Color color
return Color

currentFrame protected property

protected int currentFrame
return int

frameCount protected property

protected int frameCount
return int

frameHeight protected property

protected int frameHeight
return int

frameWidth protected property

protected int frameWidth
return int

lastAnimTime protected property

protected float lastAnimTime
return float

texture protected property

protected Texture2D,Microsoft.Xna.Framework.Graphics texture
return Microsoft.Xna.Framework.Graphics.Texture2D

timeBetweenFrames protected property

protected float timeBetweenFrames
return float