From 76c10f65e3f6d637d19502c8f3fef7be822cee8b Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 12 Apr 2022 19:45:39 -0700 Subject: [PATCH] loading Wellspring correctly --- MoonWorks.csproj | 2 +- MoonWorks.dll.config | 4 ++++ src/Graphics/Font/Structs.cs | 10 +++++----- src/Graphics/Font/TextBatch.cs | 4 ++++ src/MoonWorksDllMap.cs | 1 + 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/MoonWorks.csproj b/MoonWorks.csproj index b675391..88105d4 100644 --- a/MoonWorks.csproj +++ b/MoonWorks.csproj @@ -14,7 +14,7 @@ - + diff --git a/MoonWorks.dll.config b/MoonWorks.dll.config index 52020e4..d384162 100644 --- a/MoonWorks.dll.config +++ b/MoonWorks.dll.config @@ -11,4 +11,8 @@ + + + + diff --git a/src/Graphics/Font/Structs.cs b/src/Graphics/Font/Structs.cs index 3bf1304..37082f1 100644 --- a/src/Graphics/Font/Structs.cs +++ b/src/Graphics/Font/Structs.cs @@ -6,11 +6,11 @@ namespace MoonWorks.Graphics.Font [StructLayout(LayoutKind.Sequential)] public struct FontRange { - uint FontSize; - uint FirstCodepoint; - uint NumChars; - byte OversampleH; - byte OversampleV; + public uint FontSize; + public uint FirstCodepoint; + public uint NumChars; + public byte OversampleH; + public byte OversampleV; } [StructLayout(LayoutKind.Sequential)] diff --git a/src/Graphics/Font/TextBatch.cs b/src/Graphics/Font/TextBatch.cs index 135217f..ce246cd 100644 --- a/src/Graphics/Font/TextBatch.cs +++ b/src/Graphics/Font/TextBatch.cs @@ -11,6 +11,7 @@ namespace MoonWorks.Graphics.Font public Buffer VertexBuffer { get; protected set; } = null; public Buffer IndexBuffer { get; protected set; } = null; public Texture Texture { get; protected set; } + public uint PrimitiveCount { get; protected set; } public TextBatch(GraphicsDevice graphicsDevice) { @@ -22,6 +23,7 @@ namespace MoonWorks.Graphics.Font { Wellspring.Wellspring_StartTextBatch(Handle, packer.Handle); Texture = packer.Texture; + PrimitiveCount = 0; } public unsafe void Draw(float x, float y, float depth, Color color, string text) @@ -46,6 +48,8 @@ namespace MoonWorks.Graphics.Font { throw new System.ArgumentException("Could not decode string!"); } + + PrimitiveCount += (uint) (text.Length * 2); } } diff --git a/src/MoonWorksDllMap.cs b/src/MoonWorksDllMap.cs index 663cc58..5164838 100644 --- a/src/MoonWorksDllMap.cs +++ b/src/MoonWorksDllMap.cs @@ -195,6 +195,7 @@ namespace MoonWorks NativeLibrary.SetDllImportResolver(typeof(SDL2.SDL).Assembly, MapAndLoad); NativeLibrary.SetDllImportResolver(typeof(RefreshCS.Refresh).Assembly, MapAndLoad); NativeLibrary.SetDllImportResolver(typeof(FAudio).Assembly, MapAndLoad); + NativeLibrary.SetDllImportResolver(typeof(WellspringCS.Wellspring).Assembly, MapAndLoad); } #endregion