summaryrefslogtreecommitdiff
path: root/source/resources/management/FontManager.cs
diff options
context:
space:
mode:
authorhazel <hazel@hazelthats.me>2026-01-26 22:04:39 +0100
committerhazel <hazel@hazelthats.me>2026-01-26 22:04:39 +0100
commit567c422f8cd42eba2437f9a8c2522716a1649be7 (patch)
tree93c5b296f3b7c14b626d0aadf5cad37764c41c74 /source/resources/management/FontManager.cs
downloadcelesteia-567c422f8cd42eba2437f9a8c2522716a1649be7.tar.gz
celesteia-567c422f8cd42eba2437f9a8c2522716a1649be7.tar.bz2
celesteia-567c422f8cd42eba2437f9a8c2522716a1649be7.zip
celesteia archive, last updated april 9th 2024
Signed-off-by: hazel <hazel@hazelthats.me>
Diffstat (limited to 'source/resources/management/FontManager.cs')
-rw-r--r--source/resources/management/FontManager.cs43
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