diff options
Diffstat (limited to 'source/resources/management/FontManager.cs')
| -rw-r--r-- | source/resources/management/FontManager.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/resources/management/FontManager.cs b/source/resources/management/FontManager.cs new file mode 100644 index 0000000..482f25e --- /dev/null +++ b/source/resources/management/FontManager.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace Celesteia.Resources.Management { + public abstract class FontProperties { + public const int STANDARD_SIZE = 12; + } + + public class FontTypes { + public FontType DEFAULT { get; private set; } + private List<FontType> Types; + + public void LoadContent(ContentManager Content) { + Debug.WriteLine($"Loading fonts..."); + + Types = new List<FontType>(); + + Types.Add(DEFAULT = new FontType("Hobo", Content.Load<SpriteFont>("Hobo"))); + } + + public FontType GetFontType(string name) { + return Types.Find(x => x.Name == name); + } + } + + public class FontType { + public readonly string Name; + public readonly SpriteFont Font; + + public FontType(string name, SpriteFont font) { + Name = name; + Font = font; + + Debug.WriteLine($" Font '{name}' loaded."); + } + + public float Scale(float targetFontSize) { + return targetFontSize / FontProperties.STANDARD_SIZE; + } + } +}
\ No newline at end of file |
