daily update on 20231104 by nitload youmu
This commit is contained in:
@@ -56,7 +56,7 @@ namespace StgSharp
|
||||
/// <returns></returns>
|
||||
public static KeyStatus GetKeyStatus(Form form, Key key)
|
||||
{
|
||||
return InternalIO.glfw_GetKey(form.windowID, (int)key);
|
||||
return InternalIO.glfw.GetKey(form.windowID, (int)key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,156 +10,31 @@ namespace StgSharp
|
||||
{
|
||||
#region ssgc api define
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "initGL",
|
||||
[DllImport(SSC_libname, EntryPoint = "initGL",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe IntPtr InternalInitGL(int majorVersion, int minorVersion, GLFWapi* ptr);
|
||||
internal static extern unsafe void InternalInitGL(int majorVersion, int minorVersion);
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "linkShaderProgram",
|
||||
[DllImport(SSC_libname, EntryPoint = "linkShaderProgram",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern uint InternalLinkShaderProgram(uint shaderProgram);
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "gladLoadGLContext")]
|
||||
[DllImport(SSC_libname, EntryPoint = "gladLoadGLContext")]
|
||||
internal static extern unsafe int InternalLoadGLapi(GLcontext* contextPtr, GLfuncLoader loader);
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "loadShaderCode",
|
||||
[DllImport(SSC_libname, EntryPoint = "loadShaderCode",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe uint InternalLoadShaderCode(byte* shaderCode, int shaderType);
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "readLog",
|
||||
[DllImport(SSC_libname, EntryPoint = "readLog",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe IntPtr InternalReadLog();
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "setCurrentGLContxt")]
|
||||
[DllImport(SSC_libname, EntryPoint = "setCurrentGLContxt")]
|
||||
internal static extern unsafe void InternalSetCurrentContext(GLcontext* contextPtr);
|
||||
|
||||
#endregion
|
||||
|
||||
#region glfw api define
|
||||
|
||||
internal static glfwCreateCursor glfw_CreateCursor;
|
||||
internal static glfwCreateStandardCursor glfw_CreateStandardCursor;
|
||||
internal static glfwCreateWindow glfw_CreateWindow;
|
||||
internal static glfwDefaultWindowHints glfw_DefaultWindowHints;
|
||||
internal static glfwDestroyCursor glfw_DestroyCursor;
|
||||
internal static glfwDestroyWindow glfw_DestroyWindow;
|
||||
internal static glfwExtensionSupported glfw_ExtensionSupported;
|
||||
internal static glfwFocusWindow glfw_FocusWindow;
|
||||
internal static glfwGetClipboardString glfw_GetClipboardString;
|
||||
internal static glfwGetCurrentContext glfw_GetCurrentContext;
|
||||
internal static glfwGetCursorPos glfw_GetCursorPos;
|
||||
internal static glfwGetError glfw_GetError;
|
||||
internal static glfwGetFramebufferSize glfw_GetFramebufferSize;
|
||||
internal static glfwGetGamepadName glfw_GetGamepadName;
|
||||
internal static glfwGetGamepadState glfw_GetGamepadState;
|
||||
internal static glfwGetGammaRamp glfw_GetGammaRamp;
|
||||
internal static glfwGetInputMode glfw_GetInputMode;
|
||||
internal static glfwGetJoystickAxes glfw_GetJoystickAxes;
|
||||
internal static glfwGetJoystickButtons glfw_GetJoystickButtons;
|
||||
internal static glfwGetJoystickGUID glfw_GetJoystickGUID;
|
||||
internal static glfwGetJoystickHats glfw_GetJoystickHats;
|
||||
internal static glfwGetJoystickName glfw_GetJoystickName;
|
||||
internal static glfwGetJoystickUserPointer glfw_GetJoystickUserPointer;
|
||||
internal static glfwGetKey glfw_GetKey;
|
||||
internal static glfwGetKeyName glfw_GetKeyName;
|
||||
internal static glfwGetKeyScancode glfw_GetKeyScancode;
|
||||
internal static glfwGetMonitorContentScale glfw_GetMonitorContentScale;
|
||||
internal static glfwGetMonitorName glfw_GetMonitorName;
|
||||
internal static glfwGetMonitorPhysicalSize glfw_GetMonitorPhysicalSize;
|
||||
internal static glfwGetMonitorPos glfw_GetMonitorPos;
|
||||
internal static glfwGetMonitors glfw_GetMonitors;
|
||||
internal static glfwGetMonitorUserPointer glfw_GetMonitorUserPointer;
|
||||
internal static glfwGetMonitorWorkarea glfw_GetMonitorWorkarea;
|
||||
internal static glfwGetMouseButton glfw_GetMouseButton;
|
||||
internal static glfwGetPrimaryMonitor glfw_GetPrimaryMonitor;
|
||||
internal static glfwGetProcAddress glfw_GetProcAddress;
|
||||
internal static glfwGetRequiredInstanceExtensions glfw_GetRequiredInstanceExtensions;
|
||||
internal static glfwGetTime glfw_GetTime;
|
||||
internal static glfwGetTimerFrequency glfw_GetTimerFrequency;
|
||||
internal static glfwGetTimerValue glfw_GetTimerValue;
|
||||
internal static glfwGetVersion glfw_GetVersion;
|
||||
internal static glfwGetVersionString glfw_GetVersionString;
|
||||
internal static glfwGetVideoMode glfw_GetVideoMode;
|
||||
internal static glfwGetVideoModes glfw_GetVideoModes;
|
||||
internal static glfwGetWindowAttrib glfw_GetWindowAttrib;
|
||||
internal static glfwGetWindowContentScale glfw_GetWindowContentScale;
|
||||
internal static glfwGetWindowFrameSize glfw_GetWindowFrameSize;
|
||||
internal static glfwGetWindowMonitor glfw_GetWindowMonitor;
|
||||
internal static glfwGetWindowOpacity glfw_GetWindowOpacity;
|
||||
internal static glfwGetWindowPos glfw_GetWindowPos;
|
||||
internal static glfwGetWindowSize glfw_GetWindowSize;
|
||||
internal static glfwGetWindowUserPointer glfw_GetWindowUserPointer;
|
||||
internal static glfwHideWindow glfw_HideWindow;
|
||||
internal static glfwIconifyWindow glfw_IconifyWindow;
|
||||
internal static glfwInit glfw_Init;
|
||||
internal static glfwInitHint glfw_InitHint;
|
||||
internal static glfwJoystickIsGamepad glfw_JoystickIsGamepad;
|
||||
internal static glfwJoystickPresent glfw_JoystickPresent;
|
||||
internal static glfwMakeContextCurrent glfw_MakeContextCurrent;
|
||||
internal static glfwMaximizeWindow glfw_MaximizeWindow;
|
||||
internal static glfwPollEvents glfw_PollEvents;
|
||||
internal static glfwPostEmptyEvent glfw_PostEmptyEvent;
|
||||
internal static glfwRawMouseMotionSupported glfw_RawMouseMotionSupported;
|
||||
internal static glfwRequestWindowAttention glfw_RequestWindowAttention;
|
||||
internal static glfwRestoreWindow glfw_RestoreWindow;
|
||||
internal static glfwSetCharCallback glfw_SetCharCallback;
|
||||
internal static glfwSetCharModsCallback glfw_SetCharModsCallback;
|
||||
internal static glfwSetClipboardString glfw_SetClipboardString;
|
||||
internal static glfwSetCursor glfw_SetCursor;
|
||||
internal static glfwSetCursorEnterCallback glfw_SetCursorEnterCallback;
|
||||
internal static glfwSetCursorPos glfw_SetCursorPos;
|
||||
internal static glfwSetCursorPosCallback glfw_SetCursorPosCallback;
|
||||
internal static glfwSetDropCallback glfw_SetDropCallback;
|
||||
internal static glfwSetErrorCallback glfw_SetErrorCallback;
|
||||
internal static glfwSetFramebufferSizeCallback glfw_SetFramebufferSizeCallback;
|
||||
internal static glfwSetGamma glfw_SetGamma;
|
||||
internal static glfwSetGammaRamp glfw_SetGammaRamp;
|
||||
internal static glfwSetInputMode glfw_SetInputMode;
|
||||
internal static glfwSetJoystickCallback glfw_SetJoystickCallback;
|
||||
internal static glfwSetJoystickUserPointer glfw_SetJoystickUserPointer;
|
||||
internal static glfwSetKeyCallback glfw_SetKeyCallback;
|
||||
internal static glfwSetMonitorCallback glfw_SetMonitorCallback;
|
||||
internal static glfwSetMonitorUserPointer glfw_SetMonitorUserPointer;
|
||||
internal static glfwSetMouseButtonCallback glfw_SetMouseButtonCallback;
|
||||
internal static glfwSetScrollCallback glfw_SetScrollCallback;
|
||||
internal static glfwSetTime glfw_SetTime;
|
||||
internal static glfwSetWindowAspectRatio glfw_SetWindowAspectRatio;
|
||||
internal static glfwSetWindowAttrib glfw_SetWindowAttrib;
|
||||
internal static glfwSetWindowCloseCallback glfw_SetWindowCloseCallback;
|
||||
internal static glfwSetWindowContentScaleCallback glfw_SetWindowContentScaleCallback;
|
||||
internal static glfwSetWindowFocusCallback glfw_SetWindowFocusCallback;
|
||||
internal static glfwSetWindowIcon glfw_SetWindowIcon;
|
||||
internal static glfwSetWindowIconifyCallback glfw_SetWindowIconifyCallback;
|
||||
internal static glfwSetWindowMaximizeCallback glfw_SetWindowMaximizeCallback;
|
||||
internal static glfwSetWindowMonitor glfw_SetWindowMonitor;
|
||||
internal static glfwSetWindowOpacity glfw_SetWindowOpacity;
|
||||
internal static glfwSetWindowPos glfw_SetWindowPos;
|
||||
internal static glfwSetWindowPosCallback glfw_SetWindowPosCallback;
|
||||
internal static glfwSetWindowRefreshCallback glfw_SetWindowRefreshCallback;
|
||||
internal static glfwSetWindowShouldClose glfw_SetWindowShouldClose;
|
||||
internal static glfwSetWindowSize glfw_SetWindowSize;
|
||||
internal static glfwSetWindowSizeCallback glfw_SetWindowSizeCallback;
|
||||
internal static glfwSetWindowSizeLimits glfw_SetWindowSizeLimits;
|
||||
internal static glfwSetWindowTitle glfw_SetWindowTitle;
|
||||
internal static glfwSetWindowUserPointer glfw_SetWindowUserPointer;
|
||||
internal static glfwShowWindow glfw_ShowWindow;
|
||||
internal static glfwSwapBuffers glfw_SwapBuffers;
|
||||
internal static glfwSwapInterval glfw_SwapInterval;
|
||||
internal static glfwTerminate glfw_Terminate;
|
||||
internal static glfwUpdateGamepadMappings glfw_UpdateGamepadMappings;
|
||||
internal static glfwVulkanSupported glfw_VulkanSupported;
|
||||
internal static glfwWaitEvents glfw_WaitEvents;
|
||||
internal static glfwWaitEventsTimeout glfw_WaitEventsTimeout;
|
||||
internal static glfwWindowHint glfw_WindowHint;
|
||||
internal static glfwWindowHintString glfw_WindowHintString;
|
||||
internal static glfwWindowShouldClose glfw_WindowShouldClose;
|
||||
//internal [NotNull] static glfwGetInstanceProcAddress glfw_GetInstanceProcAddress;
|
||||
//internal [NotNull] static glfwGetPhysicalDevicePresentationSupport glfw_GetPhysicalDevicePresentationSupport;
|
||||
//internal [NotNull] static glfwCreateWindowSurface glfw_CreateWindowSurface;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
internal static IglFramework glfw = null;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
||||
@@ -20,12 +20,13 @@ namespace StgSharp
|
||||
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
internal static IntPtr SSClibPtr = IntPtr.Zero;
|
||||
|
||||
internal const string SSGC_libname =
|
||||
"StgSharpGraphic";
|
||||
internal const string SS_errorlog =
|
||||
"SS_errorlog.log";
|
||||
|
||||
internal const string SSG_errorlog =
|
||||
"SSG_errorlog.log";
|
||||
internal const string SSC_libname =
|
||||
"StgSharpC";
|
||||
|
||||
static InternalIO()
|
||||
{
|
||||
@@ -38,51 +39,76 @@ namespace StgSharp
|
||||
GLtype.Add(typeof(byte), GLconst.UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
internal static T InternalLoadProc<T>(IntPtr libPtr, string name) where T : Delegate
|
||||
{
|
||||
if (!File.Exists(InternalIO.SSG_errorlog))
|
||||
try
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SSG_errorlog);
|
||||
IntPtr procPtr = InternalGetWINproc(libPtr, name);
|
||||
T ret = Marshal.GetDelegateForFunctionPointer<T>(procPtr);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalAppendLog(string log)
|
||||
{
|
||||
if (!File.Exists(SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(SS_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
||||
{
|
||||
logStream.WriteLine(log);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("kernal32.dll", EntryPoint = "FreeLibrary",
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal extern static IntPtr InternalFreeWINlib(IntPtr libPtr);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "GetPeocAddress",
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal extern static IntPtr InternalGetWINproc(IntPtr libPtr, string procName);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "LoadLibrary",
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal extern static IntPtr InternalLoadWINlib(string name);
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
{
|
||||
if (!File.Exists(InternalIO.SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SS_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
||||
{
|
||||
logStream.WriteLine(beforeTime);
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
{
|
||||
if (!File.Exists(InternalIO.SSG_errorlog))
|
||||
if (!File.Exists(InternalIO.SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SSG_errorlog);
|
||||
FileStream stream = File.Create(InternalIO.SS_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
||||
{
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalAppendLog(string log)
|
||||
{
|
||||
if (!File.Exists(InternalIO.SSG_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SSG_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
||||
{
|
||||
logStream.WriteLine(log);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user