public MainMenuScreen() : base(String.Empty) { IsPopup = true; // Create our menu entries. MenuEntry startGameMenuEntry = new MenuEntry("Play"); MenuEntry exitMenuEntry = new MenuEntry("Exit"); // Hook up menu event handlers. startGameMenuEntry.Selected += StartGameMenuEntrySelected; exitMenuEntry.Selected += OnCancel; // Add entries to the menu. MenuEntries.Add(startGameMenuEntry); MenuEntries.Add(exitMenuEntry); LightSrc = new Vector2(0.321875f, 0.534722f); intensity = 10.0f; }
/// <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)); }