diff --git a/Voile/Source/Rendering/RaylibRenderSystem.cs b/Voile/Source/Rendering/RaylibRenderSystem.cs index 280e8ce..59f3e4a 100644 --- a/Voile/Source/Rendering/RaylibRenderSystem.cs +++ b/Voile/Source/Rendering/RaylibRenderSystem.cs @@ -39,10 +39,10 @@ namespace Voile.Rendering ConfigFlags flags = 0; // MSAA - flags |= settings.Msaa == Msaa.Msaa4x ? ConfigFlags.FLAG_MSAA_4X_HINT : 0; + flags |= settings.Msaa == Msaa.Msaa4x ? ConfigFlags.Msaa4xHint : 0; // VSync - flags |= settings.UseVSync ? ConfigFlags.FLAG_VSYNC_HINT : 0; + flags |= settings.UseVSync ? ConfigFlags.VSyncHint : 0; _fullscreen = settings.Fullscreen; @@ -59,13 +59,13 @@ namespace Voile.Rendering public override void CreateWindow(WindowSettings windowSettings) { - Raylib.SetTraceLogLevel(TraceLogLevel.LOG_NONE); + Raylib.SetTraceLogLevel(TraceLogLevel.None); _defaultWindowSettings = windowSettings; _windowSize = windowSettings.Size; ConfigFlags windowFlags = 0; - windowFlags |= windowSettings.Resizable ? ConfigFlags.FLAG_WINDOW_RESIZABLE : 0; + windowFlags |= windowSettings.Resizable ? ConfigFlags.ResizableWindow : 0; _windowTitle = windowSettings.Title; @@ -180,10 +180,10 @@ namespace Voile.Rendering { Raylib.DrawRectanglePro(new Rectangle() { - x = transformPosition.X, - y = transformPosition.Y, - width = size.X, - height = size.Y + X = transformPosition.X, + Y = transformPosition.Y, + Width = size.X, + Height = size.Y }, transformPivot, transformRotation, VoileColorToRaylibColor(color)); } @@ -252,28 +252,17 @@ namespace Voile.Rendering return Raylib.GetCurrentMonitor(); } - private unsafe void LoadFont(Font font) + private void LoadFont(Font font) { Raylib_cs.Font fontRay; - ReadOnlySpan ext = ".ttf"; // TODO: don't use a hardcoded extension. - Span 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. + string ext = ".ttf"; // TODO: don't use a hardcoded extension. + int fontChars = 250; // TODO: control this dynamically to not load the entire font. - unsafe - { - fixed (byte* extP = extBytes) - { - fixed (byte* bufferP = font.Buffer) - { - fontRay = Raylib.LoadFontFromMemory((sbyte*)extP, bufferP, (int)font.BufferSize, font.Size, null, fontChars); - } - } - } + fontRay = Raylib.LoadFontFromMemory(ext, font.Buffer, font.Size, null, fontChars); - Raylib.GenTextureMipmaps(ref fontRay.texture); - Raylib.SetTextureFilter(fontRay.texture, TextureFilter.TEXTURE_FILTER_BILINEAR); + Raylib.GenTextureMipmaps(ref fontRay.Texture); + Raylib.SetTextureFilter(fontRay.Texture, TextureFilter.Bilinear); _fontPool.Add(fontRay); @@ -288,14 +277,15 @@ namespace Voile.Rendering { fixed (void* dataPtr = texture.Buffer) { - image.data = dataPtr; + image.Data = dataPtr; } } - image.width = texture.Width; - image.height = texture.Height; - image.mipmaps = texture.Mipmaps; - image.format = (PixelFormat)texture.Format; + + image.Width = texture.Width; + image.Height = texture.Height; + image.Mipmaps = texture.Mipmaps; + image.Format = (PixelFormat)texture.Format; Texture2D rayTexture; diff --git a/Voile/Voile.csproj b/Voile/Voile.csproj index b6a4eec..e562424 100644 --- a/Voile/Voile.csproj +++ b/Voile/Voile.csproj @@ -15,7 +15,7 @@ - +