use modular initing system rather than calling Init() method.

This commit is contained in:
Youmu Liu
2025-11-11 18:22:28 +08:00
parent 678a846e54
commit 44bf78b937
65 changed files with 1328 additions and 1814 deletions
+15 -1
View File
@@ -32,10 +32,23 @@ using System.Text;
namespace StgSharp.Internal
{
public class GraphicModule : IStaticModule
{
public string ModuleName => "Graphic";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InitializeModule()
{
GraphicFramework.LoadGlfw();
}
}
internal static unsafe partial class GraphicFramework
{
private static readonly GLFWFunction _glfw = new GLFWFunction();
private static GLFWFunction _glfw ;
public static GLFWFunction glfwContext => _glfw;
@@ -44,6 +57,7 @@ namespace StgSharp.Internal
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) {
glfwLoadLibrary(func);
}