loading Wellspring correctly

pull/18/head
cosmonaut 2022-04-12 19:45:39 -07:00
parent 099c1d4fa3
commit 76c10f65e3
5 changed files with 15 additions and 6 deletions

View File

@ -14,7 +14,7 @@
<ProjectReference Include=".\lib\SDL2-CS\SDL2-CS.Core.csproj" />
<ProjectReference Include=".\lib\RefreshCS\RefreshCS.csproj" />
<ProjectReference Include=".\lib\FAudio\csharp\FAudio-CS.Core.csproj" />
<ProjectReference Include="lib\WellspringCS\WellspringCS.csproj" />
<ProjectReference Include=".\lib\WellspringCS\WellspringCS.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -11,4 +11,8 @@
<dllmap dll="FAudio" os="windows" target="FAudio.dll"/>
<dllmap dll="FAudio" os="osx" target="libFAudio.0.dylib"/>
<dllmap dll="FAudio" os="linux,freebsd,netbsd" target="libFAudio.so.0"/>
<dllmap dll="Wellspring" os="windows" target="Wellspring.dll"/>
<dllmap dll="Wellspring" os="osx" target="libWellspring.0.dylib"/>
<dllmap dll="Wellspring" os="linux,freebsd,netbsd" target="libWellspring.so.0"/>
</configuration>

View File

@ -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)]

View File

@ -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);
}
}

View File

@ -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