/// <summary> /// Loads graphics content for this screen. The background texture is quite /// big, so we use our own local ContentManager to load it. This allows us /// to unload before going from the menus into the game itself, wheras if we /// used the shared ContentManager provided by the Game class, the content /// would remain loaded forever. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); backgroundTexture = content.Load<Texture2D>("background"); SoundManager.contentManager = content; SoundManager.LoadContent(); SoundManager.PlayMainMenuSound(); if (demo) { gameObjectManager = new GameObjectManager(GameObjectManager.Mode.Demo); gameObjectManager.ScreenManager = ScreenManager; //TODO: remove redundant code gameObjectManager.ContentManager = content; gameObjectManager.SpriteBatch = ScreenManager.SpriteBatch; gameObjectManager.LoadContent(); } }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) { content = GameStateManagementGame.content; } gameObjectManager = new GameObjectManager(GameObjectManager.Mode.Normal); gameObjectManager.ScreenManager = ScreenManager; //TODO: remove redundant code gameObjectManager.ContentManager = content; gameObjectManager.SpriteBatch = ScreenManager.SpriteBatch; gameObjectManager.LoadContent(); gameFont = content.Load<SpriteFont>("gamefont"); sprite = content.Load<Texture2D>("sprite"); // A real game would probably have more content than this sample, so // it would take longer to load. We simulate that by delaying for a // while, giving you a chance to admire the beautiful loading screen. //Thread.Sleep(1000); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }