/// <summary> /// Adds a new screen to the screen manager. /// </summary> public void AddScreen(GameScreen screen) { screen.ScreenManager = this; // If we have a graphics device, tell the screen to load its content if ((graphicsDeviceService != null) && (graphicsDeviceService.GraphicsDevice != null)) { screen.LoadGraphicsContent(true); } screens.Add(screen); }
/// <summary> /// Removes a screen from the screen manager. To make the screen transition off, /// call screen.ExitScreen() instead of this method. /// </summary> public void RemoveScreen(GameScreen screen) { // If we have a graphics device, tell the screen to unload its content if ((graphicsDeviceService != null) && (graphicsDeviceService.GraphicsDevice != null)) { screen.UnloadGraphicsContent(true); } screens.Remove(screen); screensToUpdate.Remove(screen); }