public override void LoadContent() { ContentManager Content = ScreenManager.Game.Content; CreditsFont = Content.Load<SpriteFont>("Menu/Fonts/popboxFont"); MenuEntry firstLine = new MenuEntry(firstline); firstLine.FontColor = Color.White; firstLine.Font = CreditsFont; MenuEntries.Add(firstLine); this.menuTitleFont = CreditsFont; base.LoadContent(); }
/// <summary> /// Constructor lets the caller specify whether to include the standard /// "A=ok, B=cancel" usage text prompt. /// </summary> public MessageBoxScreen(string message, Texture2D background, SpriteFont font, bool includeUsageText) : base("") { const string usageText = "\nA button, Space, Enter = ok" + "\nB button, Esc = cancel"; EnabledGestures = Microsoft.Xna.Framework.Input.Touch.GestureType.Tap; if (includeUsageText) this.message = message + usageText; else this.message = message; IsPopup = true; this.background = background; this.Font = font; TransitionOnTime = TimeSpan.FromSeconds(0.2); TransitionOffTime = TimeSpan.FromSeconds(0.2); MenuEntry yesButton = new MenuEntry("YES"); yesButton.Font = font; yesButton.FontColor = Color.White; yesButton.Selected += yesButton_Selected; MenuEntry noButton = new MenuEntry("NO"); noButton.Font = font; noButton.FontColor = Color.White; noButton.Selected += noButton_Selected; MenuEntries.Add(yesButton); MenuEntries.Add(noButton); fadeOptions = true; }
/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { // Create our menu entries. ungulateMenuEntry = new MenuEntry(string.Empty); languageMenuEntry = new MenuEntry(string.Empty); frobnicateMenuEntry = new MenuEntry(string.Empty); elfMenuEntry = new MenuEntry(string.Empty); 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); }
/// <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 - menuEntryPadding, (int)entry.Position.Y - menuEntryPadding, entry.GetWidth(this) + (menuEntryPadding * 2), entry.GetHeight(this) + (menuEntryPadding * 2)); }