コード例 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public OptionsMenuScreen(ContentManager cont)
            : base("Options", cont, 25)
        {
            EnabledGestures = GestureType.Tap;
            // Create our menu entries.
            ungulateMenuEntry = new MenuEntry(string.Empty, null);
            languageMenuEntry = new MenuEntry(string.Empty, null);
            frobnicateMenuEntry = new MenuEntry(string.Empty, null);
            elfMenuEntry = new MenuEntry(string.Empty, null);

            SetMenuEntryText();

            // Hook up menu event handlers.
            ungulateMenuEntry.Selected += UngulateMenuEntrySelected;
            languageMenuEntry.Selected += LanguageMenuEntrySelected;
            frobnicateMenuEntry.Selected += FrobnicateMenuEntrySelected;
            elfMenuEntry.Selected += ElfMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(ungulateMenuEntry);
            MenuEntries.Add(languageMenuEntry);
            MenuEntries.Add(frobnicateMenuEntry);
            MenuEntries.Add(elfMenuEntry);
        }
コード例 #2
0
ファイル: MenuScreen.cs プロジェクト: hiepledinh/MarioBros
 /// <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));
 }
コード例 #3
0
        public override void LoadContent()
        {
            playIcon = Content.Load<Texture2D>("graphic/play");
            exitIcon = Content.Load<Texture2D>("graphic/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();
        }