WIP: fonts.
This commit is contained in:
@@ -4,13 +4,16 @@ public class FontLoader : IResourceLoader
|
||||
{
|
||||
public IEnumerable<string> SupportedExtensions => new string[]
|
||||
{
|
||||
".ttf"
|
||||
"ttf"
|
||||
};
|
||||
|
||||
public Type ResourceType => typeof(Font);
|
||||
|
||||
public Resource Load(string path)
|
||||
{
|
||||
return default;
|
||||
byte[] fileBuffer = File.ReadAllBytes(path);
|
||||
var result = new Font(path, fileBuffer);
|
||||
result.BufferSize = fileBuffer.Length;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace DaggerFramework
|
||||
public string? Path { get => _path; set => _path = value; }
|
||||
public byte[]? Buffer { get => _buffer; set => _buffer = value; }
|
||||
|
||||
public long BufferSize { get; set; }
|
||||
|
||||
public Resource(string path, byte[] buffer)
|
||||
{
|
||||
_path = path;
|
||||
|
||||
@@ -102,7 +102,8 @@ namespace DaggerFramework.Resources
|
||||
private readonly Dictionary<Type, IResourceLoader> _resourceLoaderAssociations = new()
|
||||
{
|
||||
{typeof(Sound), new SoundLoader()},
|
||||
{typeof(Texture2d), new Texture2dLoader()}
|
||||
{typeof(Texture2d), new Texture2dLoader()},
|
||||
{typeof(Font), new FontLoader()}
|
||||
};
|
||||
|
||||
private Dictionary<string, Resource> _loadedResources = new();
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace DaggerFramework
|
||||
{
|
||||
public SoundFormat Format { get; set; }
|
||||
public int SampleRate { get; set; }
|
||||
public int BufferSize { get; set; }
|
||||
|
||||
public Sound(string path, byte[] buffer) : base(path, buffer)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user