Use spans in RaylibRenderer's LoadFont instead of byte array.

This commit is contained in:
2024-01-21 01:07:56 +01:00
parent 85834170ab
commit cfbf46860d

View File

@@ -234,8 +234,8 @@ namespace DaggerFramework.Rendering
{
Raylib_cs.Font fontRay;
string ext = ".ttf";
byte[] extBytes = new byte[Encoding.Default.GetByteCount(ext) + 1];
ReadOnlySpan<char> ext = ".ttf"; // TODO: don't use a hardcoded extension.
Span<byte> extBytes = new byte[Encoding.Default.GetByteCount(ext) + 1];
Encoding.Default.GetBytes(ext, extBytes);
int fontChars = 2048; // TODO: control this dynamically to not load the entire font.
@@ -250,7 +250,7 @@ namespace DaggerFramework.Rendering
}
}
// Raylib.GenTextureMipmaps(ref fontRay.texture);
Raylib.GenTextureMipmaps(ref fontRay.texture);
Raylib.SetTextureFilter(fontRay.texture, TextureFilter.TEXTURE_FILTER_BILINEAR);
_fontPool.Add(fontRay);