Exemple #1
0
 /// <summary>
 /// Queries how wide the entry is, used for centering on the screen.
 /// </summary>
 public int GetWidth(MenuScreen screen)
 {
     return (int) (screen.ScreenManager.SpriteFonts.MenuSpriteFont.MeasureString(Text).X);
 }
Exemple #2
0
 /// <summary>
 /// Queries how much space this menu entry requires.
 /// </summary>
 public int GetHeight(MenuScreen screen)
 {
     return screen.ScreenManager.SpriteFonts.MenuSpriteFont.LineSpacing;
 }
Exemple #3
0
 /// <summary>
 /// Queries how wide the entry is, used for centering on the screen.
 /// </summary>
 public int GetWidth(MenuScreen screen)
 {
     return((int)(screen.ScreenManager.SpriteFonts.MenuSpriteFont.MeasureString(Text).X));
 }
Exemple #4
0
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // there is no such thing as a selected item on Windows Phone, so we always
            // force isSelected to be false
#if WINDOWS_PHONE
            isSelected = false;
#endif

            // Draw the selected entry in yellow, otherwise white.
            Color color = Color.Lerp(Color.White, new Color(255, 210, 0), _selectionFade);

            // Draw text, centered on the middle of each line.
            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.SpriteFonts.MenuSpriteFont;

            Vector2 origin = new Vector2((font.MeasureString(Text).X*(_scale - 0.7f))/4f, font.LineSpacing/2f);

            spriteBatch.DrawString(font, _text, _position, color, 0,
                                   origin, _scale, SpriteEffects.None, 0);
        }
Exemple #5
0
 /// <summary>
 /// Queries how much space this menu entry requires.
 /// </summary>
 public int GetHeight(MenuScreen screen)
 {
     return(screen.ScreenManager.SpriteFonts.MenuSpriteFont.LineSpacing);
 }