/// <summary> /// Constructor fills in the menu contents. /// </summary> public MainMenuScreen() : base("Main Menu") { // Create our menu entries. MenuEntry levelSelect = new MenuEntry("Select level"); levelSelect.Selected += SelectLevelPressed; MenuEntries.Add(levelSelect); MenuEntry highScores = new MenuEntry("High scores"); highScores.Selected += HighScoresPressed; MenuEntries.Add(highScores); }
/// <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)); }