Beispiel #1
0
        public static GLFWcursor createCursor(GLFWimage image, int x, int y)
        {
            GLFWcursor cursor = new GLFWcursor();

            cursor.handle = Glfwint.createCursor(image.handle, x, y);
            return(cursor);
        }
Beispiel #2
0
        public static void setGammaRamp(GLFWmonitor monitor, GLFWgammaramp ramp)
        {
            IntPtr ptr = new IntPtr();

            Marshal.StructureToPtr(ramp, ptr, false);
            Glfwint.setGammaRamp(monitor.handle, ptr);
        }
Beispiel #3
0
        public static GlfwVersion getVersion()
        {
            GlfwVersion version = new GlfwVersion();

            Glfwint.getVersion(ref version.Major, ref version.Minor, ref version.Revision);
            return(version);
        }
Beispiel #4
0
        public static GLFWwindow getCurrentContext()
        {
            GLFWwindow win = new GLFWwindow();

            win.handle = Glfwint.getCurrentContext();
            return(win);
        }
Beispiel #5
0
        public static GLFWcursor createStandardCursor(int shape)
        {
            GLFWcursor cursor = new GLFWcursor();

            cursor.handle = Glfwint.createStandardCursor(shape);
            return(cursor);
        }
Beispiel #6
0
        public static GLFWbuttonState[] getJoystickButtons(int joy)
        {
            int    count = 0;
            IntPtr a     = Glfwint.getJoystickButtons(joy, ref count);

            if (count != 0)
            {
                char[] o = new char[count];
                Marshal.Copy(a, o, 0, count);
                GLFWbuttonState[] t = new GLFWbuttonState[count];
                for (int i = 0; i < o.Length; i++)
                {
                    if (o [i] == (int)GLFWbuttonState.press)
                    {
                        t [i] = GLFWbuttonState.press;
                    }
                    else
                    {
                        t [i] = GLFWbuttonState.release;
                    }
                }
                return(t);
            }

            return(new GLFWbuttonState[0]);
        }
Beispiel #7
0
        public static bool extensionSupported(string extension)
        {
            IntPtr ext = Marshal.StringToHGlobalAuto(extension);
            int    val = Glfwint.extensionSupported(ext);

            return(val == 1);
        }
Beispiel #8
0
        public static GLFWmonitor getWindowMonitor(GLFWwindow window)
        {
            GLFWmonitor mon = new GLFWmonitor();

            mon.handle = Glfwint.getWindowMonitor(window.handle);
            return(mon);
        }
Beispiel #9
0
        public static GLFWmonitor getPrimaryMonitor()
        {
            GLFWmonitor newMonitor = new GLFWmonitor();

            newMonitor.handle = Glfwint.getPrimaryMonitor();
            return(newMonitor);
        }
Beispiel #10
0
        public static GLFWgammaramp getGammaRamp(GLFWmonitor monitor)
        {
            IntPtr        a    = Glfwint.getGammaRamp(monitor.handle);
            GLFWgammaramp ramp = (GLFWgammaramp)Marshal.PtrToStructure(a, typeof(GLFWgammaramp));

            return(ramp);
        }
Beispiel #11
0
        public static void setWindowIcon(GLFWwindow window, List <GLFWimage> images)
        {
            GLFWimage[] arr  = images.ToArray();
            IntPtr      addr = new IntPtr();

            Marshal.StructureToPtr(arr, addr, false);
            Glfwint.setWindowIcon(window.handle, images.Count, addr);
        }
Beispiel #12
0
 public static void getWindowFrameSize(GLFWwindow window, ref int left, ref int top, ref int right, ref int bottom)
 {
     left   = 0;
     top    = 0;
     right  = 0;
     bottom = 0;
     Glfwint.getWindowFrameSize(window.handle, ref left, ref top, ref right, ref bottom);
 }
Beispiel #13
0
 public static bool joystickPresent(int joy)
 {
     if (Glfwint.joystickPresent(joy) == 1)
     {
         return(true);
     }
     return(false);
 }
Beispiel #14
0
        public static GLFWwindow createWindow(int width, int height, string title, GLFWmonitor monitor, GLFWwindow share)
        {
            GLFWwindow win = new GLFWwindow();
            IntPtr     tmp = Glfwint.createWindow(width, height, Marshal.StringToHGlobalAuto(title), monitor.handle, share.handle);

            win.handle = tmp;
            return(win);
        }
Beispiel #15
0
        public static GLFWwindow createWindow(int width, int height, string title)
        {
            GLFWwindow win = new GLFWwindow();
            IntPtr     tmp = Glfwint.createWindow(width, height, Marshal.StringToHGlobalAuto(title), IntPtr.Zero, IntPtr.Zero);

            win.handle = tmp;
            return(win);
        }
Beispiel #16
0
        public static GLFWbuttonState getKey(GLFWwindow window, int key)
        {
            int a = Glfwint.getKey(window.handle, key);

            if (a == (int)GLFWbuttonState.press)
            {
                return(GLFWbuttonState.press);
            }
            else
            {
                return(GLFWbuttonState.release);
            }
        }
Beispiel #17
0
        public static bool windowShouldClose(GLFWwindow window)
        {
            int val = Glfwint.windowShouldClose(window.handle);

            if (Convert.ToBoolean(val))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #18
0
        public static float[] getJoystickAxes(int joy)
        {
            int    count = 0;
            IntPtr a     = Glfwint.getJoystickAxes(joy, ref count);

            if (count != 0)
            {
                float[] o = new float[count];
                Marshal.Copy(a, o, 0, count);
                return(o);
            }

            return(new float[0]);
        }
Beispiel #19
0
        public static List <GLFWvidmode> getVideoModes(GLFWmonitor monitor)
        {
            int    count    = 0;
            IntPtr modeList = Glfwint.getVideoModes(monitor.handle, ref count);

            List <GLFWvidmode> modes = new List <GLFWvidmode> ();

            for (int i = 0; i < count; i++)
            {
                GLFWvidmode newMode = new GLFWvidmode();

                newMode   = (GLFWvidmode)Marshal.PtrToStructure(modeList, typeof(GLFWvidmode));
                modeList += Marshal.SizeOf(typeof(GLFWvidmode));
                modes.Add(newMode);
            }

            return(modes);
        }
Beispiel #20
0
        public static List <GLFWmonitor> getMonitors()
        {
            int    count       = 0;
            IntPtr monitorList = Glfwint.getMonitors(ref count);

            List <GLFWmonitor> monitors = new List <GLFWmonitor> ();

            for (int i = 0; i < count; i++)
            {
                GLFWmonitor newMonitor = new GLFWmonitor();

                newMonitor.handle = (IntPtr)Marshal.PtrToStructure(monitorList, typeof(IntPtr));
                monitorList      += Marshal.SizeOf(typeof(IntPtr));
                monitors.Add(newMonitor);
            }

            return(monitors);
        }
Beispiel #21
0
        public static GLFWmode getInputMode(GLFWwindow window, GLFWmode mode)
        {
            int a = Glfwint.getInputMode(window.handle, (int)mode);

            if (a == 0)
            {
                return(GLFWmode.cursor);
            }
            else if (a == 1)
            {
                return(GLFWmode.stickyKeys);
            }
            else if (a == 2)
            {
                return(GLFWmode.stickyMouseButtons);
            }
            else
            {
                throw new Exception("Unknown code recieved from 'getInputMode', '" + a.ToString() + "'");
            }
        }
Beispiel #22
0
 public static GLFWcursorposfun setCursorPosCallback(GLFWwindow window, GLFWcursorposfun cbfun)
 {
     return(Glfwint.setCursorPosCallback(window.handle, cbfun));
 }
Beispiel #23
0
 public static string getVersionString()
 {
     return(Marshal.PtrToStringAuto(Glfwint.getVersionString()));
 }
Beispiel #24
0
 public static GLFWscrollfun setScrollCallback(GLFWwindow window, GLFWscrollfun cbfun)
 {
     return(Glfwint.setScrollCallback(window.handle, cbfun));
 }
Beispiel #25
0
 public static void setTime(double time)
 {
     Glfwint.setTime(time);
 }
Beispiel #26
0
 public static GLFWmousebuttonfun setMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cbfun)
 {
     return(Glfwint.setMouseButtonCallback(window.handle, cbfun));
 }
Beispiel #27
0
 public static GLFWkeyfun setKeyCallback(GLFWwindow window, GLFWkeyfun cbfun)
 {
     return(Glfwint.setKeyCallback(window.handle, cbfun));
 }
Beispiel #28
0
 public static GLFWjoystickfun setJoystickCallback(GLFWjoystickfun cbfun)
 {
     return(Glfwint.setJoystickCallback(cbfun));
 }
Beispiel #29
0
 public static void setInputModes(GLFWwindow window, int mode, int value)
 {
     Glfwint.setInputMode(window.handle, mode, value);
 }
Beispiel #30
0
 public static GLFWdropfun setDropCallback(GLFWwindow window, GLFWdropfun cbfun)
 {
     return(Glfwint.setDropCallback(window.handle, cbfun));
 }