Ejemplo n.º 1
0
 public void Dispose()
 {
     DiscriminatorFont.Dispose();
     NicknameFont.Dispose();
     PositionFont.Dispose();
     TitleTextFont.Dispose();
 }
Ejemplo n.º 2
0
        private void DrawText(SpriteBatch spriteBatch)
        {
            var buttonXCenter = Bounds.Width / 2;
            var textCenter    = TitleTextFont.MeasureString(Text).X / 2;
            var textXLocationRelativeToButton  = buttonXCenter - textCenter;
            var textYLocationRelativeToButton  = TextYOffset * 2 + Profession.IconSourceRectangle.Height * Game1.pixelZoom;
            var locationOfTextRelativeToButton = new Vector2(textXLocationRelativeToButton, textYLocationRelativeToButton);

            DrawTitleText(spriteBatch, locationOfTextRelativeToButton);
        }
Ejemplo n.º 3
0
        protected void DrawTitleText(SpriteBatch spriteBatch, Vector2?locationRelativeToButton = null)
        {
            var textLocation = locationRelativeToButton;

            if (locationRelativeToButton == null)
            {
                var textSize      = TitleTextFont.MeasureString(Text);
                var buttonXCenter = Bounds.X + Bounds.Width / 2;
                var buttonYCenter = Bounds.Y + Bounds.Height / 2;
                var textX         = buttonXCenter - textSize.X / 2f;
                var textY         = buttonYCenter - textSize.Y / 2f + 3f;
                textLocation = new Vector2(textX, textY);
            }
            else
            {
                textLocation += new Vector2(Bounds.X, Bounds.Y);
            }

            spriteBatch.DrawString(TitleTextFont, Text ?? string.Empty, textLocation.Value, Game1.textColor);
        }