
Mouse capturing
Posted Saturday, 21 April, 2012 - 23:18 by jyc inHello,
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) { base.OnLoad(e); GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f); GL.Enable(EnableCap.DepthTest); Mouse.Move += new EventHandler<MouseMoveEventArgs>(onMouseMoveHandler); } private void onMouseMoveHandler(object sender, MouseMoveEventArgs e) { MouseState current = OpenTK.Input.Mouse.GetState(0); Console.WriteLine(current.X); 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!
Jonathan


Comments
Re: Mouse capturing
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