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.
示例#1
0
 /// <summary>
 /// Constructs a new menu entry with the specified text.
 /// </summary>
 public MenuEntry(MenuScreen menu, string text, EntryType type, GameScreen screen)
 {
     Text = text;
     Screen = screen;
     _type = type;
     _menu = menu;
     _scale = 0.9f;
     Alpha = 1.0f;
 }
示例#2
0
 /// <summary>
 /// Constructs a new menu entry with the specified text.
 /// </summary>
 public MenuButton(Texture2D sprite, bool flip, Vector2 position, GameScreen screen)
 {
     _screen = screen;
     _scale = 1f;
     _sprite = sprite;
     _baseOrigin = new Vector2(_sprite.Width / 2f, _sprite.Height / 2f);
     Hover = false;
     _flip = flip;
     Position = position;
 }
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen(GameScreen screen)
        {
            screen.Framework = this;
            screen.IsExiting = false;

            screen.Sprites = _spriteBatch;
            screen.Lines = _lineBatch;
            screen.Quads = _quadRenderer;

            // Tell the screen to load content.
            screen.LoadContent();
            // Loading my take a while so elapsed time is reset to prevent hick-ups
            ResetElapsedTime();
            _screens.Add(screen);
        }
        /// <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 just being
        /// instantly removed.
        /// </summary>
        public void RemoveScreen(GameScreen screen)
        {
            // If we have a graphics device, tell the screen to unload content.
            if (_isInitialized)
                screen.UnloadContent();

            _screens.Remove(screen);
            _screensToUpdate.Remove(screen);

            // if there is a screen still in the manager, update TouchPanel
            // to respond to gestures that screen is interested in.
            if (_screens.Count > 0)
                TouchPanel.EnabledGestures = _screens[_screens.Count - 1].EnabledGestures;
        }
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen(GameScreen screen)
        {
            screen.ScreenManager = this;
            screen.IsExiting = false;

            // If we have a graphics device, tell the screen to load content.
            if (_isInitialized)
                screen.LoadContent();

            _screens.Add(screen);

            // update the TouchPanel to respond to gestures this screen is interested in
            TouchPanel.EnabledGestures = screen.EnabledGestures;
        }
示例#6
0
 public void AddMenuItem(string name, EntryType type, GameScreen screen)
 {
     MenuEntry entry = new MenuEntry(this, name, type, screen);
     _menuEntries.Add(entry);
 }
 /// <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 just being
 /// instantly removed.
 /// </summary>
 public void RemoveScreen(GameScreen screen)
 {
     // Tell the screen to unload content.
     screen.UnloadContent();
     _screens.Remove(screen);
     _screensToUpdate.Remove(screen);
 }
示例#8
0
        public void AddMenuItem(string name, EntryType type, GameScreen screen)
        {
            MenuEntry entry = new MenuEntry(this, name, type, screen);

            _menuEntries.Add(entry);
        }