A screen is a single layer that has update and draw logic, and which can be combined with other layers to build up a complex menu system. For instance the main menu, the options menu, the "are you sure you want to quit" message box, and the main game itself are all implemented as screens.
Exemplo n.º 1
0
        /// <summary>
        /// Removes a GameScreen from the GameScreen manager. You should normally
        /// use GameScreen.ExitScreen instead of calling this directly, so
        /// the GameScreen can gradually transition off rather than just being
        /// instantly removed.
        /// </summary>
        public void RemoveScreen(GameScreen GameScreen)
        {
            // If we have a graphics device, tell the GameScreen to unload content.
            if (isInitialized) {
                GameScreen.UnloadContent();
            }

            screens.Remove(GameScreen);
            screensToUpdate.Remove(GameScreen);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new GameScreen to the GameScreen manager.
        /// </summary>
        public void AddScreen(GameScreen GameScreen, PlayerIndex? controllingPlayer)
        {
            GameScreen.ControllingPlayer = controllingPlayer;
            GameScreen.ScreenManager = this;
            GameScreen.IsExiting = false;

            // If we have a graphics device, tell the GameScreen to load content.
            if (isInitialized) {
                GameScreen.LoadContent();
            }

            screens.Add(GameScreen);
        }