use modular initing system rather than calling Init() method.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ namespace StgSharp.Internal
|
||||
private IntPtr cursor; // _GLFWcursor* cursor;
|
||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
||||
private IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
public fixed byte keys[Constant.GLFW_KEY_LAST + 1];
|
||||
public fixed byte mouseButtons[Constant.GLFW_MOUSE_BUTTON_LAST + 1];
|
||||
public fixed byte keys[FrameworkConstant.GLFW_KEY_LAST + 1];
|
||||
public fixed byte mouseButtons[FrameworkConstant.GLFW_MOUSE_BUTTON_LAST + 1];
|
||||
|
||||
// _GLFWcontext viewPortDisplay; // 根据_GLFWcontext的定义转换
|
||||
|
||||
@@ -497,8 +497,8 @@ namespace StgSharp.Internal
|
||||
internal unsafe struct GLFWlibrary
|
||||
{
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constant.GLFW_JOYSTICK_LAST + 1)]
|
||||
private GLFWjoystick[] joysticks = new GLFWjoystick[Constant.GLFW_JOYSTICK_LAST + 1];
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = FrameworkConstant.GLFW_JOYSTICK_LAST + 1)]
|
||||
private GLFWjoystick[] joysticks = new GLFWjoystick[FrameworkConstant.GLFW_JOYSTICK_LAST + 1];
|
||||
|
||||
private GLFWallocator allocator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user