forked from rliebz/Puddle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextField.cs
50 lines (46 loc) · 1.46 KB
/
TextField.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace Puddle
{
class TextField
{
public SpriteFont Font { get; set; }
public string Message { get; set; }
public Vector2 Location { get; set; }
public Color Color { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="msg">String that the TextField will display</param>
/// <param name="loc">Vector2 with Coordinates where the TextField will display</param>
/// <param name="c">Color that the Font will be in</param>
public TextField(string msg, Vector2 loc, Color c)
{
Message = msg;
Location = loc;
Color = c;
}
/// <summary>
/// Initial load of TextField
/// Default font is Arial. Can be changed.
/// </summary>
/// <param name="content">content</param>
public void loadContent(ContentManager content)
{
Font = content.Load<SpriteFont>("Arial");
}
/// <summary>
/// Draws with current font, string, position, and font color
/// </summary>
/// <param name="sb">spritebatch</param>
public void draw(SpriteBatch sb)
{
sb.DrawString(Font, Message, Location, Color);
}
}
}