Example #1
0
        public override void LoadContent()
        {
            playIcon = Content.Load<Texture2D>("Pictures/play");
            exitIcon = Content.Load<Texture2D>("Pictures/exit");

            MenuEntry playGameMenuEntry = new MenuEntry("", playIcon);
            MenuEntry optionsMenuEntry = new MenuEntry("", exitIcon);

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);
            MenuEntries.Add(optionsMenuEntry);
            base.LoadContent();
        }
Example #2
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((int)entry.Position.X, (int)entry.Position.Y, (int)entry.GetWidth(this), (int)entry.GetHeight(this));
 }