Example #1
0
 /// <summary>
 /// Updates the menu entry.
 /// </summary>
 /// <param name="aScreen"></param>
 /// <param name="aIsSelected"></param>
 /// <param name="aGameTime"></param>
 public virtual void Update(MenuScreen aScreen, bool aIsSelected, GameTime aGameTime)
 {
 }
Example #2
0
 /// <summary>
 /// Queries how much vertical space this menu entry requires.
 /// </summary>
 /// <param name="aScreen"></param>
 /// <returns></returns>
 public virtual int GetHeight(MenuScreen aScreen)
 {
     return mFont.LineSpacing;
 }
Example #3
0
 /// <summary>
 /// Queries how much vertical space this menu entry requires.
 /// </summary>
 /// <param name="aScreen"></param>
 /// <returns></returns>
 public virtual int GetHeight(MenuScreen aScreen)
 {
     return(mFont.LineSpacing);
 }
Example #4
0
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        /// <param name="aScreen"></param>
        /// <param name="aIsSelected"></param>
        /// <param name="aGameTime"></param>
        public virtual void Draw(MenuScreen aScreen, bool aIsSelected, GameTime aGameTime)
        {
            //Draw selected entries in yellow, otherwise white
            Color lTextColor = aIsSelected ? Fonts.MenuSelectedColor : Fonts.TitleColor;

            //Draw text, ceneted on the middle of each line.
            ScreenManager lScreenManager = aScreen.ScreenManager;
            SpriteBatch lSpriteBatch = lScreenManager.SpriteBatch;

            if (mTexture != null)
            { //If we have a texture draw it and center the text on that texture
                lSpriteBatch.Draw(mTexture, mPos, Color.White);
                if ((mFont != null) && !String.IsNullOrEmpty(mText))
                {
                    Vector2 lTextSize = mFont.MeasureString(mText);
                    Vector2 lTextPos = mPos + new Vector2(
                        (float)Math.Floor((mTexture.Width - lTextSize.X) / 2),
                        (float)Math.Floor((mTexture.Height - lTextSize.Y) / 2));
                    lSpriteBatch.DrawString(mFont, mText, lTextPos, lTextColor);
                }
            }
            else if ((mFont != null) && !String.IsNullOrEmpty(mText))
            { //Otherwise just draw the text at the specified position
                lSpriteBatch.DrawString(mFont, mText, mPos, lTextColor);
            }
        }
Example #5
0
 /// <summary>
 /// Updates the menu entry.
 /// </summary>
 /// <param name="aScreen"></param>
 /// <param name="aIsSelected"></param>
 /// <param name="aGameTime"></param>
 public virtual void Update(MenuScreen aScreen, bool aIsSelected, GameTime aGameTime)
 {
 }