LADXHD/Base/Basics.cs

18 lines
606 B
C#
Raw Permalink Normal View History

2023-12-14 22:21:22 +00:00
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ProjectZ.Base
{
internal class Basics
{
public static void DrawStringCenter(SpriteFont font, string text, Rectangle position, Color color)
{
var textSize = font.MeasureString(text);
var drawPosition = new Vector2(
(int)(position.X + position.Width / 2 - textSize.X / 2),
(int)(position.Y + position.Height / 2 - textSize.Y / 2));
Game1.SpriteBatch.DrawString(font, text, drawPosition, color);
}
}
}