View Full Version : Motion with the mouse with the open gl mouse function

11-14-2000, 10:47 AM
Can someone direct to place get code for using the windows mouse detection? I need to detect motion and clicks to move a box.

11-14-2000, 10:49 AM
I meant to say motion without the open gl function. I want to use the windows mouse detection. Any help?

11-14-2000, 02:57 PM
It depends on what you're using for your Window creation. For Glut, you can setup mouse callback functions using glutMouseFunc and glutMotionFunc (I think MotionFunc is right, but I haven't actually played with glut that much yet).

For standard Win32 applications, you trap for the WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_LBUTTONUP events.

For MFC you override the OnLButtonDown (And OnRButtonDown and the Up variant for both) and OnMouseMove virtual functions of one of your classes (I usually do that from the CView derived class.)