Best, easiest mouse functions found where?

is there a simple function that you can call that gives you the mouse button status, x and y?

You know, this really depends on the platform you are using as well as the libraries that you are using. If you are using Visual Studio to develop then you can check the Visual Studio reference that came with your compiler or you can use MSDN Online at Microsoft’s web site.

If you are using GLut then you can call this function:

From OpenGl Programming Guide, page 582

void glutMotionFunc( void (*func)(int x, int y));

It specifies the function, func, that’s called when the mouse pointer moves within the window while one or more mouse buttons is pressed. The x and y callback parameters indicate the location (in window-relative coordinates) of the mouse when the event occured.


What you have to do to use this is create a function that you will use to handle mouse movements. Then when you initialize the program before you call glutMainLoop make sure you pass glutMotionFunc a pointer to your movement handling function as such:

myMouseFunction( int x, int y )
{
}

glutMotionFunc( MyMouseFunction );

This should allow you to then handle the x and y coordinates inside of this functions. I hope this helped, and remember if you are not using glut it is a lot different cause each platform uses a different messaging system. I would appreciate comments on this reply. I haven’t actually used this function before, I just have the ref manual handy.

[This message has been edited by Random_Task (edited 06-15-2000).]