-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFontLibrary.Font.TextImpl.cs
37 lines (32 loc) · 1.1 KB
/
FontLibrary.Font.TextImpl.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
using System;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
namespace FNT
{
public partial class FontLibrary
{
private partial class Font : IFont
{
private class TextImpl : IText
{
public string String { get; }
public float Width { get; }
public float Height { get; }
public TextImpl(string text, List<RenderGlyph> glyphs, float width, float height)
{
String = text;
Glyphs = glyphs;
Width = width;
Height = height;
}
public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color)
{
foreach (var glyph in Glyphs)
spriteBatch.Draw(glyph.Texture, glyph.Position + position, glyph.Bounds, color);
}
private readonly List<RenderGlyph> Glyphs;
}
}
}
}