Exemplo n.º 1
0
        public static GlFwForm CreateGlfwForm(int w, int h, string title)
        {
            GlfwWindowPtr glWindowPtr = Glfw.CreateWindow(w, h,
                                                          title,
                                                          new GlfwMonitorPtr(), //default monitor
                                                          new GlfwWindowPtr()); //default top window
            GlFwForm f = new GlFwForm();

            f.InitGlFwForm(glWindowPtr, w, h);
            f.Text = title;
            //-------------------
            //setup events for glfw window
            Glfw.SetWindowCloseCallback(glWindowPtr, s_windowCloseCb);
            Glfw.SetWindowFocusCallback(glWindowPtr, s_windowFocusCb);
            Glfw.SetWindowIconifyCallback(glWindowPtr, s_windowIconifyCb);
            Glfw.SetWindowPosCallback(glWindowPtr, s_windowPosCb);
            Glfw.SetWindowRefreshCallback(glWindowPtr, s_windowRefreshCb);
            Glfw.SetWindowSizeCallback(glWindowPtr, s_windowSizeCb);
            Glfw.SetCursorPosCallback(glWindowPtr, s_windowCursorPosCb);
            Glfw.SetCursorEnterCallback(glWindowPtr, s_windowCursorEnterCb);
            Glfw.SetMouseButtonCallback(glWindowPtr, s_windowMouseButtonCb);
            Glfw.SetScrollCallback(glWindowPtr, s_scrollCb);
            Glfw.SetKeyCallback(glWindowPtr, s_windowKeyCb);
            Glfw.SetCharCallback(glWindowPtr, s_windowCharCb);
            ////-------------------
            existingForms.Add(glWindowPtr, f);
            exitingFormList.Add(f);
            return(f);
        }
Exemplo n.º 2
0
        internal static void InitGlFwForm(GlFwForm f)
        {
            //create pointer

            GlfwWindowPtr glWindowPtr = Glfw.CreateWindow(f.Width, f.Height,
                                                          f.Text,
                                                          new GlfwMonitorPtr(), //default monitor
                                                          new GlfwWindowPtr()); //default top window

            f.InitGlFwForm(glWindowPtr, f.Width, f.Height);
            //-------------------
            //setup events for glfw window
            Glfw.SetWindowCloseCallback(glWindowPtr, s_windowCloseCb);
            Glfw.SetWindowFocusCallback(glWindowPtr, s_windowFocusCb);
            Glfw.SetWindowIconifyCallback(glWindowPtr, s_windowIconifyCb);
            Glfw.SetWindowPosCallback(glWindowPtr, s_windowPosCb);
            Glfw.SetWindowRefreshCallback(glWindowPtr, s_windowRefreshCb);
            Glfw.SetWindowSizeCallback(glWindowPtr, s_windowSizeCb);
            Glfw.SetCursorPosCallback(glWindowPtr, s_windowCursorPosCb);
            Glfw.SetCursorEnterCallback(glWindowPtr, s_windowCursorEnterCb);
            Glfw.SetMouseButtonCallback(glWindowPtr, s_windowMouseButtonCb);
            Glfw.SetScrollCallback(glWindowPtr, s_scrollCb);
            Glfw.SetKeyCallback(glWindowPtr, s_windowKeyCb);
            Glfw.SetCharCallback(glWindowPtr, s_windowCharCb);
            ////-------------------
            existingForms.Add(glWindowPtr, f);
            exitingFormList.Add(f);
        }