Esempio n. 1
0
        internal static void LoadCursors(NativeWindow window)
        {
            if (loaded)
            {
                return;
            }

            if (window != null)
            {
                string infoType = window.WindowInfo.GetType().Name;
                if (infoType == "Sdl2WindowInfo")
                {
                    usingSdl2 = true;
                }
            }

                        #if REFERENCE_WINDOWS_FORMS
            Default  = new GLCursor(System.Windows.Forms.Cursors.Default, false);
            SizeAll  = new GLCursor(System.Windows.Forms.Cursors.SizeAll);
            SizeNWSE = new GLCursor(System.Windows.Forms.Cursors.SizeNWSE);
            SizeNS   = new GLCursor(System.Windows.Forms.Cursors.SizeNS);
            SizeNESW = new GLCursor(System.Windows.Forms.Cursors.SizeNESW);
            SizeWE   = new GLCursor(System.Windows.Forms.Cursors.SizeWE);
            IBeam    = new GLCursor(System.Windows.Forms.Cursors.IBeam);
            Hand     = new GLCursor(System.Windows.Forms.Cursors.Hand, false);
            None     = new GLCursor();
                        #endif

            loaded = true;
        }
Esempio n. 2
0
        public GLGui(GameWindow parent) : base(null)
        {
            GLCursor.LoadCursors(parent);

            Gui          = this;
            base.Parent  = this;
            ParentWindow = parent;
            Outer        = parent.ClientRectangle;
            Anchor       = GLAnchorStyles.All;

            parent.Mouse.Move         += (s, e) => DoMouseMove(e);
            parent.Mouse.ButtonDown   += OnMouseDown;
            parent.Mouse.ButtonUp     += OnMouseUp;
            parent.Mouse.WheelChanged += (s, e) => DoMouseWheel(e);
            parent.MouseEnter         += (s, e) => DoMouseEnter();
            parent.MouseLeave         += (s, e) => DoMouseLeave();
            parent.KeyDown            += (s, e) => DoKeyDown(e);
            parent.KeyUp    += (s, e) => DoKeyUp(e);
            parent.KeyPress += (s, e) => DoKeyPress(e);
            parent.Resize   += (s, e) => Outer = parent.ClientRectangle;
        }
Esempio n. 3
0
        public GLGui(OpenTK.GLControl parent) : base(null)
        {
            GLCursor.LoadCursors(null);

            Gui           = this;
            base.Parent   = this;
            ParentControl = parent;
            Outer         = parent.ClientRectangle;
            Anchor        = GLAnchorStyles.All;

            int lastX = 0, lastY = 0, wheelValue = 0;

            parent.MouseMove  += (s, e) => { DoMouseMove(new MouseMoveEventArgs(e.X, e.Y, e.X - lastX, e.Y - lastY)); lastX = e.X; lastY = e.Y; };
            parent.MouseDown  += (s, e) => OnMouseDown(s, new MouseButtonEventArgs(e.X, e.Y, ToOpenTK(e.Button), true));
            parent.MouseUp    += (s, e) => OnMouseUp(s, new MouseButtonEventArgs(e.X, e.Y, ToOpenTK(e.Button), false));
            parent.MouseWheel += (s, e) => { wheelValue += e.Delta; DoMouseWheel(new MouseWheelEventArgs(e.X, e.Y, wheelValue, e.Delta)); };
            parent.MouseEnter += (s, e) => DoMouseEnter();
            parent.MouseLeave += (s, e) => DoMouseLeave();
            parent.KeyDown    += (s, e) => DoKeyDown(ToOpenTK(e));
            parent.KeyUp      += (s, e) => DoKeyUp(ToOpenTK(e));
            parent.KeyPress   += (s, e) => DoKeyPress(new KeyPressEventArgs(e.KeyChar));
            parent.Resize     += (s, e) => Outer = parent.ClientRectangle;
        }