jyc's picture

Mouse capturing


I've looked at the previous mouse capture threads, but none of them seem to work on Windows 7 x64 with the latest nightly (from 3-15).

I've tried to roll my own solution:

        protected override void OnLoad(EventArgs e)
            GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
            Mouse.Move += new EventHandler<MouseMoveEventArgs>(onMouseMoveHandler);
        private void onMouseMoveHandler(object sender, MouseMoveEventArgs e)
            MouseState current = OpenTK.Input.Mouse.GetState(0);
            if ((prevMouseX != current.X || prevMouseY != current.Y)
                && this.Focused)
                OpenTK.Input.Mouse.SetPosition(0, 0);
            prevMouseX = current.X;
            prevMouseY = current.Y;

The problem with this is that when I click on the title bar, of the application, the application is moved to the bottom of the screen.

I understand that I could probably just make the application fullscreen, but it would be nice to know how to do this as well.

Any help is appreciated. Thanks!



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
traducere engleza's picture

I'm new to this forum and to this software and would like to learn how to move the application to the top of the screen