blob: 482f25eb2a08e434eaf9cec24fb0d60c765b0997 (
plain)
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
38
39
40
41
42
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;
}
}
}
|