-
Notifications
You must be signed in to change notification settings - Fork 0
/
Text.cs
32 lines (28 loc) · 855 Bytes
/
Text.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Slip
{
public class Text : Component
{
private const int textBorder = 2;
private string text;
private Color color;
private Color borderColor;
public Text(string text, Color color, Color borderColor)
{
this.text = text;
this.color = color;
this.borderColor = borderColor;
}
public override void Initialize(Main main)
{
border = new Vector2(textBorder, textBorder);
size = Textures.Font.MeasureString(text) + 2f * border;
}
public override void Draw(Main main)
{
main.spriteBatch.DrawBorderString(Textures.Font, text, Position, color, borderColor, textBorder);
}
}
}