2018-09-15 18:15:32 +00:00
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
2018-11-12 05:05:51 +00:00
|
|
|
|
using RhythmBullet.Zer01HD.Utilities.Camera;
|
2018-09-15 18:15:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-11-13 01:54:33 +00:00
|
|
|
|
namespace RhythmBullet.Zer01HD.UI.Modular.Modules
|
2018-09-15 18:15:32 +00:00
|
|
|
|
{
|
2018-11-09 05:48:24 +00:00
|
|
|
|
public class Text : UIModule
|
2018-09-15 18:15:32 +00:00
|
|
|
|
{
|
|
|
|
|
private SpriteFont font;
|
|
|
|
|
private float scale;
|
2018-11-11 17:32:06 +00:00
|
|
|
|
private Vector2 position;
|
2018-09-15 18:15:32 +00:00
|
|
|
|
public string DisplayedText
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return DisplayedText;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Vector2 size = font.MeasureString(value);
|
2018-11-11 17:32:06 +00:00
|
|
|
|
Bounds.Width = (int) size.X;
|
|
|
|
|
scale = Bounds.Height / size.Y;
|
2018-09-15 18:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Text(string displayedText, SpriteFont font, int height)
|
|
|
|
|
{
|
2018-11-11 17:32:06 +00:00
|
|
|
|
Bounds.Height = height;
|
2018-09-15 18:15:32 +00:00
|
|
|
|
this.font = font;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-13 00:34:11 +00:00
|
|
|
|
public override void Draw(SpriteBatch batch)
|
2018-09-15 18:15:32 +00:00
|
|
|
|
{
|
2018-11-11 17:32:06 +00:00
|
|
|
|
position.X = Bounds.X;
|
|
|
|
|
position.Y = Bounds.Y;
|
|
|
|
|
batch.DrawString(font, DisplayedText, position, Color);
|
2018-11-13 00:34:11 +00:00
|
|
|
|
base.Draw(batch);
|
2018-09-15 18:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|