C# Class GameGraphics.Sprite

Show file Open project: pmyoung/Advanced-Game-Project

Public Methods

Method Description
GetFrameHeight ( ) : int

Gets the height of the animation frame

GetFrameWidth ( ) : int

Gets the width of the animation frame

GetSprite ( ) : Microsoft.Xna.Framework.Graphics.Texture2D

Gets the image the sprite uses

GetSpriteType ( ) : string

Gets the type of object this sprite should be used for

Render ( SpriteBatch spriteBatch, GraphicsObject obj ) : void

Renders the given GraphicsObject

Render ( SpriteBatch spriteBatch, Rectangle bounds, Color color, float rotation, Vector2 origin, SpriteEffects effect, float layer, int action, int frame ) : void

Render method that all overloads call.

Render ( SpriteBatch spriteBatch, int x, int y, int radius, Color color, int angle, float layer, int action, int frame ) : void

Render this overload allows basic rendering of a sprite that has circular properties.

SetFrameHeight ( int height ) : void

Sets the height of each frame of animation

SetFrameWidth ( int width ) : void

Sets how wide each frame of animation is

SetSprite ( Microsoft.Xna.Framework.Graphics.Texture2D sprite ) : void

Sets the image that this sprite will use

SetSpriteType ( string type ) : void

Sets the type of sprite that this image will be used with

Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D sprite, int frameWidth, int frameHeight, string type ) : System

The Sprite Constructor that requires a Texture2D object (image file), and the type of object (like ship, planet).

setFrameRectangle ( int width, int height ) : void

Sets the width and height of each frame of animation

Method Details

GetFrameHeight() public method

Gets the height of the animation frame
public GetFrameHeight ( ) : int
return int

GetFrameWidth() public method

Gets the width of the animation frame
public GetFrameWidth ( ) : int
return int

GetSprite() public method

Gets the image the sprite uses
public GetSprite ( ) : Microsoft.Xna.Framework.Graphics.Texture2D
return Microsoft.Xna.Framework.Graphics.Texture2D

GetSpriteType() public method

Gets the type of object this sprite should be used for
public GetSpriteType ( ) : string
return string

Render() public method

Renders the given GraphicsObject
public Render ( SpriteBatch spriteBatch, GraphicsObject obj ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Contains graphics contexts for rendering on the game screen
obj GraphicsObject The GraphicsObject that is to be rendered
return void

Render() public method

Render method that all overloads call.
public Render ( SpriteBatch spriteBatch, Rectangle bounds, Color color, float rotation, Vector2 origin, SpriteEffects effect, float layer, int action, int frame ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Contains graphics contexts for rendering on the game screen
bounds Microsoft.Xna.Framework.Rectangle The region of the screen the sprite will be drawn at
color Color Changes the color of the sprite
rotation float The amount to rotate the sprite in radians
origin Vector2 The point on the sprite that is used as the center of rotation
effect SpriteEffects Chosen sprite mirroring option (like None, FlipHorizontally)
layer float Represents the depth 0 front of layer 1 back of layer
action int Integer representing what "action" of the sprite to display
frame int Integer representing what "frame" of the action animation to display
return void

Render() public method

Render this overload allows basic rendering of a sprite that has circular properties.
public Render ( SpriteBatch spriteBatch, int x, int y, int radius, Color color, int angle, float layer, int action, int frame ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Contains graphics contexts for rendering on the game screen
x int The left-right/west-east location of the sprite
y int The up-down/north-south location of the sprite
radius int The radius of the "circle"
color Color Changes the color of the sprite
angle int The angle of the sprite in degrees
layer float Represents the depth 0 front of layer 1 back of layer
action int Integer representing what "action" of the sprite to display
frame int Integer representing what "frame" of the action animation to display
return void

SetFrameHeight() public method

Sets the height of each frame of animation
public SetFrameHeight ( int height ) : void
height int The height of the animation frame
return void

SetFrameWidth() public method

Sets how wide each frame of animation is
public SetFrameWidth ( int width ) : void
width int The width of the animation frame
return void

SetSprite() public method

Sets the image that this sprite will use
public SetSprite ( Microsoft.Xna.Framework.Graphics.Texture2D sprite ) : void
sprite Microsoft.Xna.Framework.Graphics.Texture2D The image that will be used for the sprite
return void

SetSpriteType() public method

Sets the type of sprite that this image will be used with
public SetSpriteType ( string type ) : void
type string The type of object this sprite is used for
return void

Sprite() public method

The Sprite Constructor that requires a Texture2D object (image file), and the type of object (like ship, planet).
public Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D sprite, int frameWidth, int frameHeight, string type ) : System
sprite Microsoft.Xna.Framework.Graphics.Texture2D sprite The image that the sprite will use
frameWidth int The width of each frame of animation on the sprite
frameHeight int The height of each frame of animation on the sprite
type string type The type of sprite (like Ship, Planet)
return System

setFrameRectangle() public method

Sets the width and height of each frame of animation
public setFrameRectangle ( int width, int height ) : void
width int The width of the animation frame
height int The height of the animation frame
return void