capturing mouse movement outside window

Started by
4 comments, last by riz 22 years, 1 month ago
Hey all, I am writing a program as a console (non-win32 app), and I am wondering how to capture mouse movement when the mouse is not in the window. You see, I am writing a very simple 3D shooter and I want to capture when the mouse moves left or right. Right now, if the mouse cursor moves out of the window, openGL will stop registering mouse motion events. I think capturing mouse motion outside the window has something to do with glutEntryFunc(). I know that if i were using a win32 app, i could use getCursor()... is there a way to do that in a non-win32 app using glut? thanks, Rizwan
Advertisement
opengl was NOT designed for input hence you cant do this. make your window fullscreen.

glut is a poor excuse for portable methods of dealing with a windowed gui enviroment (ie win9x, X). whether you like it or not, if it runs in windows, its a win32 app. the choice you make for the project simply tells vc++ how to deal with the code you supply (ie you can create a full blown windows app from a console projectm just like you can create a console project from a "win32 app" project).

if this is trully a non win32 app that is running in X, look up X stuff, and you should be all good (i dont know how X handles capturing mouse input).
Maybe SDL allows you to do this? It has a lot more functonality than GLUT. http://www.libsdl.org/
Dirk =[Scarab]= Gerrits
If you can get the hWnd for your GLUT window (someone posted this the other day) then you should be able to call SetCapture.
This will only work outside your window while you have a mouse button pressed.



Slightly shrimpy smell == unsafe breadbin
Slightly shrimpy smell == unsafe breadbin
simple 3d shooters dont let the mouse move out of the window

http://uk.geocities.com/sloppyturds/gotterdammerung.html
You may want to try DirectInput in DirectX. You can obligate the mouse to send all its input to your program at that point (IF you are programming in Windows - I assume everyone uses Windows, I forget that sometimes!)

This topic is closed to new replies.

Advertisement