コード例 #1
0
        // Create Window
        public void CreateWindow()
        {
            using (OpenGL.CoreUI.NativeWindow nativeWindow = OpenGL.CoreUI.NativeWindow.Create())
            {
                nativeWindow.ContextCreated += NativeWindow_ContextCreated;
                nativeWindow.Render         += NativeWindow_Render;
                nativeWindow.MouseMove      += NativeWindow_MouseEvent;
                nativeWindow.Resize         += NativeWindow_Resize;
                nativeWindow.KeyDown        += (object obj, NativeWindowKeyEventArgs e) =>
                {
                    switch (e.Key)
                    {
                    case KeyCode.Escape:
                        close();
                        nativeWindow.Stop();
                        break;

                    case KeyCode.F:
                        nativeWindow.Fullscreen = !nativeWindow.Fullscreen;
                        break;
                    }

                    viewer.keyEventFunction(e);
                };

                //nativeWindow.MultisampleBits = 4;

                int wnd_h = Screen.PrimaryScreen.Bounds.Height;
                int wnd_w = Screen.PrimaryScreen.Bounds.Width;

                int height = (int)(wnd_h * 0.9f);
                int width  = (int)(wnd_w * 0.9f);

                if (width > zedCamera.ImageWidth && height > zedCamera.ImageHeight)
                {
                    width  = zedCamera.ImageWidth;
                    height = zedCamera.ImageHeight;
                }

                nativeWindow.Create((int)(zedCamera.ImageWidth * 0.05f), (int)(zedCamera.ImageHeight * 0.05f), 1200, 700, NativeWindowStyle.Resizeable);
                nativeWindow.Show();
                nativeWindow.Run();
            }
        }
コード例 #2
0
        // Create Window
        public void CreateWindow()
        {
            using (OpenGL.CoreUI.NativeWindow nativeWindow = OpenGL.CoreUI.NativeWindow.Create())
            {
                nativeWindow.ContextCreated += NativeWindow_ContextCreated;
                nativeWindow.Render         += NativeWindow_Render;
                nativeWindow.MouseDown      += NativeWindow_MouseDown;
                nativeWindow.KeyDown        += (object obj, NativeWindowKeyEventArgs e) =>
                {
                    switch (e.Key)
                    {
                    case KeyCode.Escape:
                        close();
                        nativeWindow.Stop();
                        break;

                    case KeyCode.F:
                        nativeWindow.Fullscreen = !nativeWindow.Fullscreen;
                        break;

                    case KeyCode.Space:
                        userAction.pressSpace = true;
                        break;
                    }
                };


                int wnd_h = Screen.PrimaryScreen.Bounds.Height;
                int wnd_w = Screen.PrimaryScreen.Bounds.Width;

                int height = (int)(wnd_h * 0.9f);
                int width  = (int)(wnd_w * 0.9f);

                if (width > zedCamera.ImageWidth && height > zedCamera.ImageHeight)
                {
                    width  = zedCamera.ImageWidth;
                    height = zedCamera.ImageHeight;
                }

                nativeWindow.Create((int)(zedCamera.ImageWidth * 0.05f), (int)(zedCamera.ImageHeight * 0.05f), (uint)width, (uint)height, NativeWindowStyle.Resizeable);
                nativeWindow.Show();
                nativeWindow.Run();
            }
        }