/// <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> /// Constructs a new menu entry with the specified text. /// </summary> public MenuEntry(GameScreen owningScreen, string text, EntryType type, GameScreen linkScreen) { _text = text; _owningScreen = owningScreen; _linkScreen = linkScreen; _type = type; _scale = 0.9f; _alpha = 1.0f; _settingsChange = null; _optionRequiresRestart = false; }
/// <summary> /// Constructor. /// </summary> public PauseScreen(GameScreen activeGameScreen) { _menuTitle = "Paused"; _activeGameScreen = activeGameScreen; AddMenuItem("Return to Game", EntryType.ScreenExitItem, null, false); AddMenuItem("Options", EntryType.Screen, GlobalGameOptions.OptionsMenu, false); AddMenuItem("Exit to Main Menu", EntryType.ScreenExitItem, null, true); AddMenuItem("", EntryType.Separator, null); AddMenuItem("Exit to Desktop", EntryType.GlobalExitItem, null); TransitionOnTime = TimeSpan.FromSeconds(0.7); TransitionOffTime = TimeSpan.FromSeconds(0.7); HasCursor = true; }
public MenuEntry(GameScreen owningScreen, SettingsChangeDisplayUpdate displayUpdateFunction, EntryType type, SettingsChangeDelegate settingsChange, bool optionRequiresRestart) { _text = displayUpdateFunction(); _owningScreen = owningScreen; _linkScreen = null; _type = type; _scale = 0.9f; _alpha = 1.0f; _settingsChange = settingsChange; _displayUpdateFunction = displayUpdateFunction; _optionRequiresRestart = optionRequiresRestart; }
public void AddMenuItem(string name, EntryType type, GameScreen screen, bool closeParentScreen) { MenuEntry entry = new MenuEntry(this, name, type, screen, closeParentScreen); _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) { // 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; }