C# Class MonoGameFoundation.Sprite

A sprite to animate via a sprite sheet.
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Afficher le fichier Open project: half-ogre/MonoGameQuest

Méthodes publiques

Méthode Description
Draw ( GameTime gameTime ) : void

Draws the sprite.

Initialize ( ) : void

Initializes the sprite.

This creates the SpriteBatch. If you override Initialize, be sure to call base.Initialize to create the SpriteBatch.

Sprite ( Microsoft.Xna.Framework.Game game, Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, int pixelWidth, int pixelHeight, int pixelOffsetX, int pixelOffsetY ) : System

Creates a new Sprite instance.

Update ( GameTime gameTime ) : void

Updates the sprite's current animation.

Méthodes protégées

Méthode Description
BeginSpriteBatch ( ) : void

Calls SpriteBatch.Begin with default arguments. Override if you need to change the arguments to SpriteBatch.Begin.

Sprite ( Microsoft.Xna.Framework.Game game, Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, int pixelWidth, int pixelHeight, int pixelOffsetX, int pixelOffsetY, Vector2 pixelPosition ) : System

Creates a new Sprite instance.

Method Details

BeginSpriteBatch() protected méthode

Calls SpriteBatch.Begin with default arguments. Override if you need to change the arguments to SpriteBatch.Begin.
protected BeginSpriteBatch ( ) : void
Résultat void

Draw() public méthode

Draws the sprite.
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The game's current time.
Résultat void

Initialize() public méthode

Initializes the sprite.
This creates the SpriteBatch. If you override Initialize, be sure to call base.Initialize to create the SpriteBatch.
public Initialize ( ) : void
Résultat void

Sprite() public méthode

Creates a new Sprite instance.
public Sprite ( Microsoft.Xna.Framework.Game game, Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, int pixelWidth, int pixelHeight, int pixelOffsetX, int pixelOffsetY ) : System
game Microsoft.Xna.Framework.Game The global game instance.
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D The sprite sheet containing the sprite's animation frames.
pixelWidth int The width of the sprite in pixels.
pixelHeight int The height of the sprite in pixels.
pixelOffsetX int The sprite's X offset, used to to center the sprite on its location.
pixelOffsetY int The sprite's Y offset, used to to center the sprite on its location.
Résultat System

Sprite() protected méthode

Creates a new Sprite instance.
protected Sprite ( Microsoft.Xna.Framework.Game game, Microsoft.Xna.Framework.Graphics.Texture2D spriteSheet, int pixelWidth, int pixelHeight, int pixelOffsetX, int pixelOffsetY, Vector2 pixelPosition ) : System
game Microsoft.Xna.Framework.Game The global game instance.
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D The sprite sheet containing the sprite's animation frames.
pixelWidth int The width of the sprite in pixels.
pixelHeight int The height of the sprite in pixels.
pixelOffsetX int The sprite's X offset, used to to center the sprite on its location.
pixelOffsetY int The sprite's Y offset, used to to center the sprite on its location.
pixelPosition Vector2 The sprite position in the display, in pixels.
Résultat System

Update() public méthode

Updates the sprite's current animation.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The game's current time.
Résultat void