November 2008
Beginner
510 pages
16h 24m
English
Wow. That may have seemed like a lot of work, but I guarantee you'll be pleased
with what this has done for your code. Your sprite manager is complete and is
already wired up to your Game1 class. However,
you still have all the code that you added to Game1 in the previous chapters. You can now go into that class and
delete everything but the SpriteManager code and
the generated code that was originally there. Your Game1 class should look something like this:
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; namespace AnimatedSprites { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; SpriteManager spriteManager; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { spriteManager = new SpriteManager(this); Components.Add(spriteManager); base.Initialize(); } protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); } protected override void UnloadContent() { // TODO: Unload any non ContentManager ...