rhythmbullet/RhythmBullet/Zer01HD/Utilities/UI/Modular/Text.cs

41 lines
979 B
C#
Raw Normal View History

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.UI.Modular
{
2018-11-09 05:48:24 +00:00
public class Text : UIModule
{
private SpriteFont font;
private float scale;
public string DisplayedText
{
get
{
return DisplayedText;
}
set
{
Vector2 size = font.MeasureString(value);
Width = size.X;
scale = Height / size.Y;
}
}
public Text(string displayedText, SpriteFont font, int height)
{
this.font = font;
Height = height;
}
public override void Draw(SpriteBatch batch)
{
batch.DrawString(font, DisplayedText, Position, Color);
base.Draw(batch);
}
}
}