public void AddScreen(GameScreen screen) { // Allows you to add a screen to the stack, and load any necessary content screen.ScreenManager = this; if (this.isInitialized) { screen.LoadContent(); screen.Initialize(); } screens.Add(screen); }
public void RemoveScreen(GameScreen screen) { // Allows you to remove a screen from the stack, which also stops it from updating // Remember to add .dispose to the unloadcontent method on each screen so content can // actually be removed from memory. if (this.isInitialized) { screen.UnloadContent(); } screens.Remove(screen); screensToUpdate.Remove(screen); }