/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { // Create our menu entries. backgroundMusicMenuEntry = new MenuEntry(string.Empty); gameplaySoundMenuEntry = new MenuEntry(string.Empty); SetMenuEntryText(); // Hook up menu event handlers. backgroundMusicMenuEntry.Selected += MusicMenuEntrySelected; gameplaySoundMenuEntry.Selected += GameplaySoundEntrySelected; // Add entries to the menu. MenuEntries.Add(backgroundMusicMenuEntry); MenuEntries.Add(gameplaySoundMenuEntry); }
/// <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("Highscore"); MenuEntry aboutMenuEntry = new MenuEntry("About"); // Hook up menu event handlers. playGameMenuEntry.Selected += PlayGameMenuEntrySelected; optionsMenuEntry.Selected += OptionsMenuEntrySelected; highScoreMenuEntry.Selected += HighscoreMenuEntrySelected; aboutMenuEntry.Selected += AboutMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(playGameMenuEntry); MenuEntries.Add(highScoreMenuEntry); MenuEntries.Add(optionsMenuEntry); MenuEntries.Add(aboutMenuEntry); }
/// <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)); }