Enrichir les sprites : textures, défilement, transformation, animation
CHAPITRE 6
127
Verdana
26
10
true




~




Vous n’avez plus qu’à charger la police en déclarant un objet de type SpriteFont et enfin
compléter la méthode DrawString().
Classe de test du SpriteFont
public class ChapitreSix : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
SpriteFont font;
public ChapitreSix()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
ServiceHelper.Game = this;
Components.Add(new KeyboardService(this));
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
font = Content.Load("font");
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
=Labat FM.book Page 127 Vendredi, 19. juin 2009 4:01 16
Précédent

- 148/366

Suivant