/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { // Create our menu entries. ungulateMenuEntry = new MenuEntry(string.Empty); languageMenuEntry = new MenuEntry(string.Empty); frobnicateMenuEntry = new MenuEntry(string.Empty); elfMenuEntry = new MenuEntry(string.Empty); SetMenuEntryText(); MenuEntry back = new MenuEntry("Back"); // Hook up menu event handlers. ungulateMenuEntry.Selected += UngulateMenuEntrySelected; languageMenuEntry.Selected += LanguageMenuEntrySelected; frobnicateMenuEntry.Selected += FrobnicateMenuEntrySelected; elfMenuEntry.Selected += ElfMenuEntrySelected; back.Selected += OnCancel; // Add entries to the menu. MenuEntries.Add(ungulateMenuEntry); MenuEntries.Add(languageMenuEntry); MenuEntries.Add(frobnicateMenuEntry); MenuEntries.Add(elfMenuEntry); MenuEntries.Add(back); }
/// <summary> /// Constructor. /// </summary> public PauseMenuScreen() : base("Paused") { // Create our menu entries. MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game"); MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game"); // Hook up menu event handlers. resumeGameMenuEntry.Selected += OnCancel; quitGameMenuEntry.Selected += QuitGameMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(resumeGameMenuEntry); MenuEntries.Add(quitGameMenuEntry); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public MainMenuScreen() : base("Chess Tactics") { // Create our menu entries. MenuEntry playGameMenuEntry = new MenuEntry("Play"); MenuEntry optionsMenuEntry = new MenuEntry("Options"); MenuEntry exitMenuEntry = new MenuEntry("Quit"); // Hook up menu event handlers. playGameMenuEntry.Selected += PlayGameMenuEntrySelected; optionsMenuEntry.Selected += OptionsMenuEntrySelected; exitMenuEntry.Selected += OnCancel; // Add entries to the menu. MenuEntries.Add(playGameMenuEntry); MenuEntries.Add(optionsMenuEntry); MenuEntries.Add(exitMenuEntry); }
/// <summary> /// Sets the position relative to the passed entry. /// Vector2.Zero here will result in the exact same position /// as the passed entry. /// </summary> /// <param name="position">The position relative to the passed entry</param> /// <param name="entry">The entry you wish to use as a base</param> /// <param name="initialPosition">True if the passed position is an initial position for this entry, as in the entry will default to this position after animations and effects</param> public void SetRelativePosition(Vector2 relativePosition, MenuEntry entry, bool initialPosition) { Vector2 position = new Vector2(entry.position.X, entry.position.Y); if (entry.entryTexture != null) position.Y += entry.entryTexture.Height; SetPosition(Vector2.Add(position, relativePosition), initialPosition); }