Пример #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public CreditsMenuScreen()
     : base("")
 {
     // Create our menu entries.
     creditsMenuEntry = new MenuEntry(creditsText);
     // Add entries to the menu.
     MenuEntries.Add(creditsMenuEntry);
 }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public OptionsMenuScreen()
            : base("")
        {
            // Create our menu entries.
            soundMenuEntry = new MenuEntry(string.Empty);
            soundFxMenuEntry = new MenuEntry(string.Empty);
            // Hook up menu event handlers.
            soundMenuEntry.Selected += SoundMenuEntrySelected;
            soundFxMenuEntry.Selected += SoundFxMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(soundMenuEntry);
            MenuEntries.Add(soundFxMenuEntry);
        }
Пример #3
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("")
        {
            // Create our menu entries.
            MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
            MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry helpMenuEntry = new MenuEntry("Help");
            MenuEntry creditsMenuEntry = new MenuEntry("Credits");

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            helpMenuEntry.Selected += HelpMenuEntrySelected;
            creditsMenuEntry.Selected += CreditsMenuEntrySelected;
            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);
            MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(helpMenuEntry);
            MenuEntries.Add(creditsMenuEntry);
        }
Пример #4
0
 /// <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));
 }