예제 #1
0
        /// <summary>
        /// Removes a screen from the screen manager. You should normally
        /// use GameScreen.ExitScreen() instead of calling this directly,
        /// so the screen can gradually transition off rather than being
        /// instantly removed.
        /// </summary>
        /// <param name="screen"></param>
        public void RemoveScreen(GameScreen screen)
        {
            //If we have a graphics device, tell the screen to unload content.
            if (isInitialized)
            {
                screen.Unload();
            }

            screens.Remove(screen);
            tempScreensList.Remove(screen);
        }
예제 #2
0
        /// <summary>
        /// Adds a new screen to the screen manager
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="controllingPlayer"></param>
        public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
        {
            screen.ControllingPlayer = controllingPlayer;
            screen.Manager = this;
            screen.IsExiting = false;

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

            screens.Add(screen);
        }