daily update on 20240423 by nitload youmu, mvvm confirm

This commit is contained in:
YoumuLiu
2024-04-24 02:52:43 +08:00
parent 915a560b43
commit 32c0a0f99b
35 changed files with 732 additions and 783 deletions
@@ -64,20 +64,20 @@ namespace StgSharp.Graphics
private int major, minor, revision;
/*
void (* makeCurrent) (GLFWwindow*);
void (* swapBuffers) (GLFWwindow*);
void (* makeCurrent) (glfwWindow*);
void (* swapBuffers) (glfwWindow*);
void (* swapInterval) (int);
int (* extensionSupported) (const byte*);
GLFWglproc(*getProcAddress)(const byte*);
void (* destroy) (GLFWwindow*);
void (* destroy) (glfwWindow*);
*/
private delegate*<GLFWwindow*> makeCurrent;
private delegate*<glfwWindow*> makeCurrent;
private int profile;
private int release;
private int robustness;
private int source;
private delegate*<GLFWwindow*> swapBuffer;
private delegate*<glfwWindow*> swapBuffer;
private delegate*<int> swapInterval;
internal struct egl
@@ -230,7 +230,7 @@ namespace StgSharp.Graphics
private int widthMM, heightMM;
// The window whose video mode is current on this monitor
//GLFWwindow* window;
//glfwWindow* window;
private IntPtr window;
// not transformed
@@ -242,102 +242,67 @@ namespace StgSharp.Graphics
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWwindow
unsafe struct glfwWindow
{
glfwWindow* next;
private int autoIconify;
// Window settings and state
int resizable;
int decorated;
int autoIconify;
int floating;
int focusOnShow;
int mousePassthrough;
int shouldClose;
void* userPointer;
int doublebuffer;
// GLFWvidmode videoMode; // 根据GLFWvidmode的定义转换
IntPtr monitor; // _GLFWmonitor* monitor;
IntPtr cursor; // _GLFWcursor* cursor;
private fixed long callBacks[17];
private GLFWcursor* cursor = (GLFWcursor*)0;
private int cursorMode = 0;
private int decorated;
private bool doubleBuffer;
private int floating;
private int focusOnShow;
private fixed byte keys[349];
private int lockKeyMods;
private int maxWidth = 0, maxHeight = 0;
int minwidth, minheight;
int maxwidth, maxheight;
int numer, denom;
private int minWidth = 0, minHeight = 0;
private IntPtr monitor = IntPtr.Zero; //public GLFWmonitor* monitor;
private fixed byte mouseButtons[8];
private int mousePassthrough;
private int numer = 0, denom = 0;
private int rawMouseMotion;
private int resizable;
private int stickyKeys;
private int stickyMouseButtons;
private void* userPointer = (void*)0;
private GLFWvidmode videoMode = default;
internal int shouldClose;
public GLFWcontext context = default;
//struct GLFWwindow* next in GLFW
public GLFWwindow* next;
int stickyKeys;
int stickyMouseButtons;
int lockKeyMods;
int cursorMode;
public fixed byte mouseButtons[GLconst.GLFW_MOUSE_BUTTON_LAST + 1];
public fixed byte keys[GLconst.GLFW_KEY_LAST + 1];
// Virtual cursor position when cursor is disabled
public double virtualCursorPosX = 0, virtualCursorPosY = 0;
double virtualCursorPosX, virtualCursorPosY;
bool rawMouseMotion;
public GLFWwindow()
{
}
// _GLFWcontext context; // 根据_GLFWcontext的定义转换
public bool AutoIconify
// Callbacks are represented as IntPtr since we don't need the actual function pointers in C#
struct Callbacks
{
get => autoIconify != 0;
set => autoIconify = value ? 1 : 0;
}
public bool Decorated
{
get => decorated != 0;
set => decorated = value ? 1 : 0;
}
public bool Floating
{
get => floating != 0;
set => floating = value ? 1 : 0;
}
public bool FocusOnShow
{
get => focusOnShow != 0;
set => focusOnShow = value ? 1 : 0;
}
public bool LockKeyMods
{
get => lockKeyMods != 0;
set => lockKeyMods = value ? 1 : 0;
}
public bool MousePassThrough
{
get => mousePassthrough != 0;
set => mousePassthrough = value ? 1 : 0;
}
public bool RawMouseMotion { get => rawMouseMotion != 0; set => rawMouseMotion = value ? 1 : 0; }
public bool Resizable
{
get => resizable != 0;
set => resizable = value ? 1 : 0;
}
public bool ShouldClose
{
get => shouldClose != 0;
set => shouldClose = value ? 1 : 0;
IntPtr pos;
IntPtr size;
IntPtr close;
IntPtr refresh;
IntPtr focus;
IntPtr iconify;
IntPtr maximize;
IntPtr fbsize;
IntPtr scale;
IntPtr mouseButton;
IntPtr cursorPos;
IntPtr cursorEnter;
IntPtr scroll;
IntPtr key;
IntPtr character;
IntPtr charmods;
IntPtr drop;
}
Callbacks callbacks;
public bool StickyKey
{
get => stickyKeys != 0;
set => stickyKeys = value ? 1 : 0;
}
public bool StickyMouseButtons
{
get => stickyMouseButtons != 0;
set => stickyMouseButtons = value ? 1 : 0;
}
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct GLFWwindowCallback
@@ -479,7 +444,7 @@ namespace StgSharp.Graphics
private int release;
private int robustness;
//GLFWwindow* share;
//glfwWindow* share;
private IntPtr share;
private int source;
@@ -558,7 +523,7 @@ namespace StgSharp.Graphics
private GLFWplatform platform;
//GLFWwindow* windowListHead;
//glfwWindow* windowListHead;
private IntPtr windowListHead;
internal Callbacks callbacks = new Callbacks();
@@ -791,7 +756,7 @@ namespace StgSharp.Graphics
// EGL
//EGLenum(*getEGLPlatform)(EGLint**);
//EGLNativeDisplayType(*getEGLNativeDisplay)(void);
//EGLNativeWindowType(*getEGLNativeWindow)(GLFWwindow*);
//EGLNativeWindowType(*getEGLNativeWindow)(glfwWindow*);
internal IntPtr getEGLPlatform;
internal IntPtr getFramebufferSize;
internal IntPtr getGammaRamp;
@@ -805,7 +770,7 @@ namespace StgSharp.Graphics
// vulkan
//void (* getRequiredInstanceExtensions) (byte**);
//GLFWbool(*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice, uint32_t);
//VkResult(*createWindowSurface)(VkInstance, GLFWwindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
//VkResult(*createWindowSurface)(VkInstance, glfwWindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
internal IntPtr getRequiredInstanceExtensions;
internal IntPtr getScancodeName;
internal IntPtr getVideoMode;
@@ -831,15 +796,15 @@ namespace StgSharp.Graphics
internal IntPtr setCursorMode;
#region input
/* void (* getCursorPos) (GLFWwindow*, double*, double*);
void (* setCursorPos) (GLFWwindow*, double, double);
void (* setCursorMode) (GLFWwindow*, int);
void (* setRawMouseMotion) (GLFWwindow*, GLFWbool);
/* void (* getCursorPos) (glfwWindow*, double*, double*);
void (* setCursorPos) (glfwWindow*, double, double);
void (* setCursorMode) (glfwWindow*, int);
void (* setRawMouseMotion) (glfwWindow*, GLFWbool);
GLFWbool(*rawMouseMotionSupported)(void);
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
void (* destroyCursor) (GLFWcursor*);
void (* setCursor) (GLFWwindow*, GLFWcursor*);
void (* setCursor) (glfwWindow*, GLFWcursor*);
const byte* (*getScancodeName)(int);
int (* getKeyScancode) (int);
void (* setClipboardString) (const byte*);
@@ -859,39 +824,39 @@ namespace StgSharp.Graphics
GLFWbool(*getGammaRamp)(GLFWmonitor*, GLFWgammaramp*);
void (* setGammaRamp) (GLFWmonitor*,const GLFWgammaramp*);
// window
GLFWbool(*createWindow)(GLFWwindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
void (* destroyWindow) (GLFWwindow*);
void (* setWindowTitle) (GLFWwindow*,const byte*);
void (* setWindowIcon) (GLFWwindow*, int,const GLFWimage*);
void (* getWindowPos) (GLFWwindow*, int*, int*);
void (* setWindowPos) (GLFWwindow*, int, int);
void (* getWindowSize) (GLFWwindow*, int*, int*);
void (* setWindowSize) (GLFWwindow*, int, int);
void (* setWindowSizeLimits) (GLFWwindow*, int, int, int, int);
void (* setWindowAspectRatio) (GLFWwindow*, int, int);
void (* getFramebufferSize) (GLFWwindow*, int*, int*);
void (* getWindowFrameSize) (GLFWwindow*, int*, int*, int*, int*);
void (* getWindowContentScale) (GLFWwindow*, float*, float*);
void (* iconifyWindow) (GLFWwindow*);
void (* restoreWindow) (GLFWwindow*);
void (* maximizeWindow) (GLFWwindow*);
void (* showWindow) (GLFWwindow*);
void (* hideWindow) (GLFWwindow*);
void (* requestWindowAttention) (GLFWwindow*);
void (* focusWindow) (GLFWwindow*);
void (* setWindowMonitor) (GLFWwindow*, GLFWmonitor*, int, int, int, int, int);
GLFWbool(*windowFocused)(GLFWwindow*);
GLFWbool(*windowIconified)(GLFWwindow*);
GLFWbool(*windowVisible)(GLFWwindow*);
GLFWbool(*windowMaximized)(GLFWwindow*);
GLFWbool(*windowHovered)(GLFWwindow*);
GLFWbool(*framebufferTransparent)(GLFWwindow*);
float (* getWindowOpacity) (GLFWwindow*);
void (* setWindowResizable) (GLFWwindow*, GLFWbool);
void (* setWindowDecorated) (GLFWwindow*, GLFWbool);
void (* setWindowFloating) (GLFWwindow*, GLFWbool);
void (* setWindowOpacity) (GLFWwindow*, float);
void (* setWindowMousePassthrough) (GLFWwindow*, GLFWbool);
GLFWbool(*createWindow)(glfwWindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
void (* destroyWindow) (glfwWindow*);
void (* setWindowTitle) (glfwWindow*,const byte*);
void (* setWindowIcon) (glfwWindow*, int,const GLFWimage*);
void (* getWindowPos) (glfwWindow*, int*, int*);
void (* setWindowPos) (glfwWindow*, int, int);
void (* getWindowSize) (glfwWindow*, int*, int*);
void (* setWindowSize) (glfwWindow*, int, int);
void (* setWindowSizeLimits) (glfwWindow*, int, int, int, int);
void (* setWindowAspectRatio) (glfwWindow*, int, int);
void (* getFramebufferSize) (glfwWindow*, int*, int*);
void (* getWindowFrameSize) (glfwWindow*, int*, int*, int*, int*);
void (* getWindowContentScale) (glfwWindow*, float*, float*);
void (* iconifyWindow) (glfwWindow*);
void (* restoreWindow) (glfwWindow*);
void (* maximizeWindow) (glfwWindow*);
void (* showWindow) (glfwWindow*);
void (* hideWindow) (glfwWindow*);
void (* requestWindowAttention) (glfwWindow*);
void (* focusWindow) (glfwWindow*);
void (* setWindowMonitor) (glfwWindow*, GLFWmonitor*, int, int, int, int, int);
GLFWbool(*windowFocused)(glfwWindow*);
GLFWbool(*windowIconified)(glfwWindow*);
GLFWbool(*windowVisible)(glfwWindow*);
GLFWbool(*windowMaximized)(glfwWindow*);
GLFWbool(*windowHovered)(glfwWindow*);
GLFWbool(*framebufferTransparent)(glfwWindow*);
float (* getWindowOpacity) (glfwWindow*);
void (* setWindowResizable) (glfwWindow*, GLFWbool);
void (* setWindowDecorated) (glfwWindow*, GLFWbool);
void (* setWindowFloating) (glfwWindow*, GLFWbool);
void (* setWindowOpacity) (glfwWindow*, float);
void (* setWindowMousePassthrough) (glfwWindow*, GLFWbool);
void (* pollEvents) (void);
void (* waitEvents) (void);
void (* waitEventsTimeout) (double);
@@ -177,7 +177,7 @@ namespace StgSharp.Graphics
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate int glfwWindowShouldClose(IntPtr window);
//[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal unsafe delegate GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
//[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal unsafe delegate int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
//[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal unsafe delegate VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
//[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal unsafe delegate VkResult glfwCreateWindowSurface(VkInstance instance, glfwWindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
#endregion
+17 -17
View File
@@ -88,28 +88,28 @@ namespace StgSharp.Graphics
#region GLFW_dele
internal unsafe delegate void GLFWwindowsizefun(GLFWwindow* window, int width, int height);
internal unsafe delegate void GLFWwindowrefreshfun(GLFWwindow* window);
internal unsafe delegate void GLFWwindowposfun(GLFWwindow* window, int xpos, int ypos);
internal unsafe delegate void GLFWwindowmaximizefun(GLFWwindow* window, int maximized);
internal unsafe delegate void GLFWwindowiconifyfun(GLFWwindow* window, int iconified);
internal unsafe delegate void GLFWwindowfocusfun(GLFWwindow* window, int focused);
internal unsafe delegate void GLFWwindowcontentscalefun(GLFWwindow* window, float xscale, float yscale);
internal unsafe delegate void GLFWwindowclosefun(GLFWwindow* window);
internal unsafe delegate void GLFWwindowsizefun(glfwWindow* window, int width, int height);
internal unsafe delegate void GLFWwindowrefreshfun(glfwWindow* window);
internal unsafe delegate void GLFWwindowposfun(glfwWindow* window, int xpos, int ypos);
internal unsafe delegate void GLFWwindowmaximizefun(glfwWindow* window, int maximized);
internal unsafe delegate void GLFWwindowiconifyfun(glfwWindow* window, int iconified);
internal unsafe delegate void GLFWwindowfocusfun(glfwWindow* window, int focused);
internal unsafe delegate void GLFWwindowcontentscalefun(glfwWindow* window, float xscale, float yscale);
internal unsafe delegate void GLFWwindowclosefun(glfwWindow* window);
internal unsafe delegate void GLFWvkproc();
internal unsafe delegate void GLFWscrollfun(GLFWwindow* window, double xoffset, double yoffset);
internal unsafe delegate void GLFWmousebuttonfun(GLFWwindow* window, int button, int action, int mods);
internal unsafe delegate void GLFWscrollfun(glfwWindow* window, double xoffset, double yoffset);
internal unsafe delegate void GLFWmousebuttonfun(glfwWindow* window, int button, int action, int mods);
internal unsafe delegate void GLFWmonitorfun(GLFWmonitor* monitor, int monitorevent);
internal unsafe delegate void GLFWkeyfun(GLFWwindow* window, int key, int scancode, int action, int mods);
internal unsafe delegate void GLFWkeyfun(glfwWindow* window, int key, int scancode, int action, int mods);
internal unsafe delegate void GLFWjoystickfun(int jid, int keyevent);
public unsafe delegate void GLFWglproc();
internal unsafe delegate void FramebuffersizeHandler(IntPtr window, int width, int height); //window is the pointer to a GLFWwindow instance
internal unsafe delegate void FramebuffersizeHandler(IntPtr window, int width, int height); //window is the pointer to a glfwWindow instance
internal unsafe delegate void GLFWerrorfun(int error_code, sbyte* description);
internal unsafe delegate void GLFWdropfun(GLFWwindow* window, int path_count, sbyte*[] paths);
internal unsafe delegate void GLFWcursorposfun(GLFWwindow* window, double xpos, double ypos);
internal unsafe delegate void GLFWcursorenterfun(GLFWwindow* window, int entered);
internal unsafe delegate void GLFWcharmodsfun(GLFWwindow* window, uint codepoint, int mods);
internal unsafe delegate void GLFWcharfun(GLFWwindow* window, uint codepoint);
internal unsafe delegate void GLFWdropfun(glfwWindow* window, int path_count, sbyte*[] paths);
internal unsafe delegate void GLFWcursorposfun(glfwWindow* window, double xpos, double ypos);
internal unsafe delegate void GLFWcursorenterfun(glfwWindow* window, int entered);
internal unsafe delegate void GLFWcharmodsfun(glfwWindow* window, uint codepoint, int mods);
internal unsafe delegate void GLFWcharfun(glfwWindow* window, uint codepoint);
#endregion