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