daily update on 20240423 by nitload youmu, mvvm confirm
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace StgSharp.Graphics
|
||||
internal Vector4 backgroundColor;
|
||||
internal TimeSpanProvider fpsCountProvider;
|
||||
internal TimeSpanProvider frameTimeProvider;
|
||||
internal IntPtr graphicContextID;
|
||||
internal RenderStream mainRenderStream;
|
||||
internal int height;
|
||||
internal IntPtr monitor;
|
||||
internal string name;
|
||||
@@ -126,7 +126,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
internal unsafe IntPtr id => windowID;
|
||||
|
||||
protected FrameBufferSizeHandler FrameBufferSizeCallback
|
||||
protected FrameBufferSizeHandler FrameSizeCallback
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -135,57 +135,6 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void DeInit();
|
||||
|
||||
/// <summary>
|
||||
/// Necessary operation to init graphic elements this form.
|
||||
/// </summary>
|
||||
/// <param name="gl">OpenGL library binded to current form.</param>
|
||||
protected abstract void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Behaviour of current form when in a frame cycle.
|
||||
/// </summary>
|
||||
protected abstract void Main();
|
||||
|
||||
/// <summary>
|
||||
/// Init an OpenGl context if current form has not been binded to any context. and set the context binded to
|
||||
/// current form as current OpenGL context.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">
|
||||
/// Something goes wrong and StgSharp fails in creating a new OpenGL context.
|
||||
/// </exception>
|
||||
public unsafe void MakeAsCurrentContext()
|
||||
{
|
||||
if (windowID == default)
|
||||
{
|
||||
IntPtr windowPtr;
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(name);
|
||||
if (sharedForm == null)
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(width, height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(width, height, tittleBytes, monitor, sharedForm.windowID);
|
||||
}
|
||||
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
|
||||
{
|
||||
throw new Exception("Cannot create window instance!");
|
||||
}
|
||||
else
|
||||
{
|
||||
windowID = windowPtr;
|
||||
}
|
||||
|
||||
graphicContextID = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GLcontext)));
|
||||
GLcontext* contextID = (GLcontext*)graphicContextID;
|
||||
*contextID = new GLcontext();
|
||||
contextID->glGetString = (delegate*<uint, IntPtr>)IntPtr.Zero;
|
||||
}
|
||||
GL.api = (GLcontext*)graphicContextID;
|
||||
InternalIO.glfwMakeContextCurrent(windowID);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -213,7 +162,6 @@ namespace StgSharp.Graphics
|
||||
InternalIO.glfwSetWindowSize(this.windowID, (int)size.X, (int)size.Y);
|
||||
}
|
||||
|
||||
protected abstract void ProcessInput();
|
||||
|
||||
/// <summary>
|
||||
/// Resize the current form
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace StgSharp.Graphics
|
||||
public unsafe class ElementBuffer : BufferObjectBase
|
||||
{
|
||||
|
||||
internal ElementBuffer(int n, Form binding)
|
||||
internal ElementBuffer(int n, glRenderStream binding)
|
||||
{
|
||||
this.binding = binding.graphicContextID;
|
||||
this.binding = binding.ContextHandle;
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace StgSharp.Graphics
|
||||
|
||||
public class FrameBuffer : BufferObjectBase
|
||||
{
|
||||
internal unsafe FrameBuffer(int count, IntPtr contextBinding)
|
||||
internal unsafe FrameBuffer(int count, glRenderStream contextBinding)
|
||||
{
|
||||
binding = contextBinding;
|
||||
binding = contextBinding.ContextHandle;
|
||||
_bufferHandle = new glHandleSet(count);
|
||||
((GLcontext*)binding)->glGenFramebuffers((uint)count,_bufferHandle.handle);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace StgSharp.Graphics
|
||||
public unsafe class VertexArray : BufferObjectBase
|
||||
{
|
||||
|
||||
internal VertexArray(int n, Form binding)
|
||||
internal VertexArray(int n, glRenderStream binding)
|
||||
{
|
||||
this.binding = binding.graphicContextID;
|
||||
this.binding = binding.ContextHandle;
|
||||
_bufferHandle = GL.GenVertexArrays(n);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace StgSharp.Graphics
|
||||
public unsafe class VertexBuffer : BufferObjectBase
|
||||
{
|
||||
|
||||
internal VertexBuffer(int n, Form binding)
|
||||
internal VertexBuffer(int n, glRenderStream binding)
|
||||
{
|
||||
this.binding = binding.graphicContextID;
|
||||
this.binding = binding.ContextHandle;
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace StgSharp.Graphics
|
||||
internal glHandleSet _textureHandle;
|
||||
internal Image[] sourceList;
|
||||
|
||||
internal Texture(int n, Form binding)
|
||||
internal Texture(int n, glRenderStream binding)
|
||||
{
|
||||
sourceList = new Image[n];
|
||||
this.binding = binding.graphicContextID;
|
||||
this.binding = binding.ContextHandle;
|
||||
_textureHandle = GL.GenTextures(n);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public partial class Form
|
||||
public partial class glRenderStream
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public abstract partial class glRenderStream:RenderStream
|
||||
{
|
||||
protected IntPtr glContextHandle
|
||||
{
|
||||
get { return ContextHandle; }
|
||||
set { ContextHandle = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init an OpenGl context if current form has not been binded to any context. and set the context binded to
|
||||
/// current form as current OpenGL context.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">
|
||||
/// Something goes wrong and StgSharp fails in creating a new OpenGL context.
|
||||
/// </exception>
|
||||
public unsafe void MakeAsCurrentContext()
|
||||
{
|
||||
if (CanvasHandle == default)
|
||||
{
|
||||
IntPtr windowPtr;
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(name);
|
||||
if (SharedCanvas == IntPtr.Zero)
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(Width, Height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(Width, Height, tittleBytes, monitor, SharedCanvas.CanvasHandle);
|
||||
}
|
||||
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
|
||||
{
|
||||
throw new Exception("Cannot create window instance!");
|
||||
}
|
||||
else
|
||||
{
|
||||
CanvasHandle = windowPtr;
|
||||
}
|
||||
|
||||
ContextHandle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GLcontext)));
|
||||
GLcontext* contextID = (GLcontext*)ContextHandle;
|
||||
*contextID = new GLcontext();
|
||||
contextID->glGetString = (delegate*<uint, IntPtr>)IntPtr.Zero;
|
||||
}
|
||||
GL.api = (GLcontext*)ContextHandle;
|
||||
InternalIO.glfwMakeContextCurrent(CanvasHandle);
|
||||
}
|
||||
|
||||
internal sealed override void InternalInit()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
internal sealed override void InternalDraw()
|
||||
{
|
||||
MakeAsCurrentContext();
|
||||
Main();
|
||||
}
|
||||
|
||||
|
||||
internal sealed override void InternalTerminate()
|
||||
{
|
||||
Deinit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="RenderStream.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public abstract class RenderStream
|
||||
{
|
||||
|
||||
private IntPtr canvasHandle;
|
||||
private IntPtr contextHandle;
|
||||
private IntPtr monitor;
|
||||
private IntPtr sharedCanvas;
|
||||
|
||||
private int height;
|
||||
private int width;
|
||||
protected string name;
|
||||
|
||||
public IntPtr CanvasHandle
|
||||
{
|
||||
get => canvasHandle;
|
||||
internal set => canvasHandle = value;
|
||||
}
|
||||
|
||||
public IntPtr ContextHandle
|
||||
{
|
||||
get => contextHandle;
|
||||
internal set => contextHandle = value;
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get => height;
|
||||
internal set => height = value;
|
||||
}
|
||||
|
||||
public IntPtr Monitor
|
||||
{
|
||||
get => monitor;
|
||||
internal set => monitor = value;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => name;
|
||||
internal set => name = value;
|
||||
}
|
||||
|
||||
public IntPtr SharedCanvas
|
||||
{
|
||||
get => sharedCanvas;
|
||||
internal set => sharedCanvas = value;
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get => width;
|
||||
internal set => width = value;
|
||||
}
|
||||
|
||||
protected abstract void Init();
|
||||
protected abstract void Main();
|
||||
protected abstract void Deinit();
|
||||
protected abstract void ProcessInput();
|
||||
|
||||
internal abstract void InternalInit();
|
||||
internal abstract void InternalDraw();
|
||||
internal abstract void InternalTerminate();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="framework.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
#if Windows
|
||||
// using Windows.Win32;
|
||||
#endif
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal partial class InternalIO
|
||||
{
|
||||
#region api call
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwInit")] internal static extern unsafe int glfwInit();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwTerminate")] internal static extern unsafe void glfwTerminate();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwInitHint")] internal static extern unsafe void glfwInitHint(int hint, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVersion")] internal static extern unsafe void glfwGetVersion(int* major, int* minor, int* rev);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVersionString")] internal static extern unsafe byte* glfwGetVersionString();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetError")] internal static extern unsafe int glfwGetError(byte** description);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetErrorCallback")] internal static extern unsafe GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitors")] internal static extern unsafe IntPtr* glfwGetMonitors(int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetPrimaryMonitor")] internal static extern unsafe IntPtr glfwGetPrimaryMonitor();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorPos")] internal static extern unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorWorkarea")] internal static extern unsafe void glfwGetMonitorWorkarea(IntPtr monitor, int* xpos, int* ypos, int* width, int* height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorPhysicalSize")] internal static extern unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorContentScale")] internal static extern unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorName")] internal static extern unsafe byte* glfwGetMonitorName(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorUserPointer")] internal static extern unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorUserPointer")] internal static extern unsafe void* glfwGetMonitorUserPointer(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorCallback")] internal static extern unsafe GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoModes")] internal static extern unsafe GLFWvidmode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoMode")] internal static extern unsafe GLFWvidmode* glfwGetVideoMode(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGamma")] internal static extern unsafe void glfwSetGamma(IntPtr monitor, float gamma);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGammaRamp")] internal static extern unsafe GLFWgammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGammaRamp")] internal static extern unsafe void glfwSetGammaRamp(IntPtr monitor, GLFWgammaramp* ramp);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDefaultWindowHints")] internal static extern unsafe void glfwDefaultWindowHints();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHint")] internal static extern unsafe void glfwWindowHint(int hint, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHintString")] internal static extern unsafe void glfwWindowHintString(int hint, byte* value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateWindow")] internal static extern unsafe IntPtr glfwCreateWindow(int width, int height, byte[] title, IntPtr monitor, IntPtr share);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyWindow")] internal static extern unsafe void glfwDestroyWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowShouldClose")] internal static extern unsafe int glfwWindowShouldClose(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowShouldClose")] internal static extern unsafe void glfwSetWindowShouldClose(IntPtr window, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowTitle")] internal static extern unsafe void glfwSetWindowTitle(IntPtr window, byte* title);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIcon")] internal static extern unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowPos")] internal static extern unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPos")] internal static extern unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowSize")] internal static extern unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeLimits")] internal static extern unsafe void glfwSetWindowSizeLimits(IntPtr window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAspectRatio")] internal static extern unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSize")] internal static extern unsafe void glfwSetWindowSize(IntPtr window, int width, int height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetFramebufferSize")] internal static extern unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowFrameSize")] internal static extern unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowContentScale")] internal static extern unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowOpacity")] internal static extern unsafe float glfwGetWindowOpacity(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowOpacity")] internal static extern unsafe void glfwSetWindowOpacity(IntPtr window, float opacity);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwIconifyWindow")] internal static extern unsafe void glfwIconifyWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRestoreWindow")] internal static extern unsafe void glfwRestoreWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMaximizeWindow")] internal static extern unsafe void glfwMaximizeWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwShowWindow")] internal static extern unsafe void glfwShowWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwHideWindow")] internal static extern unsafe void glfwHideWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwFocusWindow")] internal static extern unsafe void glfwFocusWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRequestWindowAttention")] internal static extern unsafe void glfwRequestWindowAttention(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowMonitor")] internal static extern unsafe IntPtr glfwGetWindowMonitor(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMonitor")] internal static extern unsafe void glfwSetWindowMonitor(IntPtr window, IntPtr monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowAttrib")] internal static extern unsafe int glfwGetWindowAttrib(IntPtr window, int attrib);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAttrib")] internal static extern unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowUserPointer")] internal static extern unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowUserPointer")] internal static extern unsafe void* glfwGetWindowUserPointer(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPosCallback")] internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(IntPtr window, GLFWwindowposfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeCallback")] internal static extern unsafe GLFWwindowsizefun glfwSetWindowSizeCallback(IntPtr window, GLFWwindowsizefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowCloseCallback")] internal static extern unsafe GLFWwindowclosefun glfwSetWindowCloseCallback(IntPtr window, GLFWwindowclosefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowRefreshCallback")] internal static extern unsafe GLFWwindowrefreshfun glfwSetWindowRefreshCallback(IntPtr window, GLFWwindowrefreshfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowFocusCallback")] internal static extern unsafe GLFWwindowfocusfun glfwSetWindowFocusCallback(IntPtr window, GLFWwindowfocusfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIconifyCallback")] internal static extern unsafe GLFWwindowiconifyfun glfwSetWindowIconifyCallback(IntPtr window, GLFWwindowiconifyfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMaximizeCallback")] internal static extern unsafe GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(IntPtr window, GLFWwindowmaximizefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetFramebufferSizeCallback")] internal static extern unsafe FramebuffersizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowContentScaleCallback")] internal static extern unsafe GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(IntPtr window, GLFWwindowcontentscalefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPollEvents")] internal static extern unsafe void glfwPollEvents();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWaitEvents")] internal static extern unsafe void glfwWaitEvents();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWaitEventsTimeout")] internal static extern unsafe void glfwWaitEventsTimeout(double timeout);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPostEmptyEvent")] internal static extern unsafe void glfwPostEmptyEvent();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetInputMode")] internal static extern unsafe int glfwGetInputMode(IntPtr window, int mode);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetInputMode")] internal static extern unsafe void glfwSetInputMode(IntPtr window, int mode, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRawMouseMotionSupported")] internal static extern unsafe int glfwRawMouseMotionSupported();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyName")] internal static extern unsafe byte* glfwGetKeyName(int key, int scancode);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyScancode")] internal static extern unsafe int glfwGetKeyScancode(int key);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKey")] internal static extern unsafe KeyStatus glfwGetKey(IntPtr window, int key);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMouseButton")] internal static extern unsafe int glfwGetMouseButton(IntPtr window, int button);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCursorPos")] internal static extern unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPos")] internal static extern unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateCursor")] internal static extern unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateStandardCursor")] internal static extern unsafe GLFWcursor* glfwCreateStandardCursor(int shape);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyCursor")] internal static extern unsafe void glfwDestroyCursor(GLFWcursor* cursor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursor")] internal static extern unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetKeyCallback")] internal static extern unsafe GLFWkeyfun glfwSetKeyCallback(IntPtr window, GLFWkeyfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharCallback")] internal static extern unsafe GLFWcharfun glfwSetCharCallback(IntPtr window, GLFWcharfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharModsCallback")] internal static extern unsafe GLFWcharmodsfun glfwSetCharModsCallback(IntPtr window, GLFWcharmodsfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMouseButtonCallback")] internal static extern unsafe GLFWmousebuttonfun glfwSetMouseButtonCallback(IntPtr window, GLFWmousebuttonfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPosCallback")] internal static extern unsafe GLFWcursorposfun glfwSetCursorPosCallback(IntPtr window, GLFWcursorposfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorEnterCallback")] internal static extern unsafe GLFWcursorenterfun glfwSetCursorEnterCallback(IntPtr window, GLFWcursorenterfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetScrollCallback")] internal static extern unsafe GLFWscrollfun glfwSetScrollCallback(IntPtr window, GLFWscrollfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetDropCallback")] internal static extern unsafe GLFWdropfun glfwSetDropCallback(IntPtr window, GLFWdropfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickPresent")] internal static extern unsafe int glfwJoystickPresent(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickAxes")] internal static extern unsafe float* glfwGetJoystickAxes(int jid, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickButtons")] internal static extern unsafe byte* glfwGetJoystickButtons(int jid, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickHats")] internal static extern unsafe byte* glfwGetJoystickHats(int jid, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickName")] internal static extern unsafe byte* glfwGetJoystickName(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickGUID")] internal static extern unsafe byte* glfwGetJoystickGUID(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetJoystickUserPointer")] internal static extern unsafe void glfwSetJoystickUserPointer(int jid, void* pointer);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickUserPointer")] internal static extern unsafe void* glfwGetJoystickUserPointer(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickIsGamepad")] internal static extern unsafe int glfwJoystickIsGamepad(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetJoystickCallback")] internal static extern unsafe GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwUpdateGamepadMappings")] internal static extern unsafe int glfwUpdateGamepadMappings(byte* str);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadName")] internal static extern unsafe byte* glfwGetGamepadName(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadState")] internal static extern unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetClipboardString")] internal static extern unsafe void glfwSetClipboardString(IntPtr window, byte* str);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetClipboardString")] internal static extern unsafe byte* glfwGetClipboardString(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTime")] internal static extern unsafe double glfwGetTime();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetTime")] internal static extern unsafe void glfwSetTime(double time);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerValue")] internal static extern unsafe ulong* glfwGetTimerValue();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerFrequency")] internal static extern unsafe ulong* glfwGetTimerFrequency();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMakeContextCurrent")] internal static extern unsafe void glfwMakeContextCurrent(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCurrentContext")] internal static extern unsafe IntPtr glfwGetCurrentContext();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapBuffers")] internal static extern unsafe void glfwSwapBuffers(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapInterval")] internal static extern unsafe void glfwSwapInterval(int interval);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwExtensionSupported")] internal static extern unsafe int glfwExtensionSupported(byte* extension);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetProcAddress", CharSet = CharSet.Ansi)] internal static extern unsafe IntPtr glfwGetProcAddress(string procname);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwVulkanSupported")] internal static extern unsafe int glfwVulkanSupported();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetRequiredInstanceExtensions")] internal static extern unsafe byte** glfwGetRequiredInstanceExtensions(uint* count);
|
||||
|
||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetInstanceProcAddress")] internal extern unsafe static GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
|
||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal extern unsafe static int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
|
||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwCreateWindowSurface")] internal extern unsafe static VkResult glfwCreateWindowSurface(VkInstance instance, glfwWindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
#endregion api call
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user