mirror of
https://github.com/Phantop/LADXHD.git
synced 2024-10-31 20:04:18 +00:00
18 lines
606 B
C#
18 lines
606 B
C#
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|