/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { // Create our menu entries. gameModeMenuEntry = new MenuEntry(string.Empty); gameDifficultyMenuEntry = new MenuEntry(string.Empty); languageMenuEntry = new MenuEntry(string.Empty); SoundEffectsMenuEntry = new MenuEntry(string.Empty); elfMenuEntry = new MenuEntry(string.Empty); SetMenuEntryText(); // Hook up menu event handlers. gameModeMenuEntry.Selected += UngulateMenuEntrySelected; gameDifficultyMenuEntry.Selected += gameDifficultyMenuEntrySelected; languageMenuEntry.Selected += LanguageMenuEntrySelected; SoundEffectsMenuEntry.Selected += SoundEffectsMenuEntrySelected; elfMenuEntry.Selected += ElfMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(gameModeMenuEntry); MenuEntries.Add(gameDifficultyMenuEntry); MenuEntries.Add(languageMenuEntry); MenuEntries.Add(SoundEffectsMenuEntry); MenuEntries.Add(elfMenuEntry); }
public HighScoreScreen() { EnabledGestures = GestureType.Tap; gameModeMenuEntry = new MenuEntry(string.Empty); gameDifficultyMenuEntry = new MenuEntry(string.Empty); SetMenuEntryText(); // event handlers // Hook up menu event handlers. gameModeMenuEntry.Selected += gameModeMenuEntrySelected; gameDifficultyMenuEntry.Selected += gameDifficultyMenuEntrySelected; }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public MainMenuScreen() : base("Main Menu") { // Create our menu entries. MenuEntry playGameMenuEntry = new MenuEntry("Play Game"); MenuEntry optionsMenuEntry = new MenuEntry("Options"); MenuEntry highScoreMenuEntry = new MenuEntry("High Score"); MenuEntry exitMenuEntry = new MenuEntry("Exit"); // Hook up menu event handlers. playGameMenuEntry.Selected += PlayGameMenuEntrySelected; optionsMenuEntry.Selected += OptionsMenuEntrySelected; highScoreMenuEntry.Selected += HighScoreMenuEntrySelected; exitMenuEntry.Selected += ExitMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(playGameMenuEntry); MenuEntries.Add(optionsMenuEntry); MenuEntries.Add(highScoreMenuEntry); MenuEntries.Add(exitMenuEntry); }
/// <summary> /// Allows the screen to create the hit bounds for a particular menu entry. /// </summary> protected virtual Rectangle GetMenuEntryHitBounds(MenuEntry entry) { // the hit bounds are the entire width of the screen, and the height of the entry // with some additional padding above and below. return new Rectangle( 0, (int)entry.Position.Y - menuEntryPadding, ScreenManager.GraphicsDevice.Viewport.Width, entry.GetHeight(this) + (menuEntryPadding * 2)); }
/// <summary> /// Allows the screen to create the hit bounds for a particular menu entry. /// </summary> Rectangle GetMenuEntryHitBounds(MenuEntry entry) { // the hit bounds are the entire width of the screen, and the height of the entry // with some additional padding above and below. return new Rectangle( (int)entry.Position.X, (int)entry.Position.Y - menuEntryPadding, entry.GetWidth(this) + (menuEntryPadding *2), entry.GetHeight(this) + (menuEntryPadding * 2)); }