PDA

View Full Version : Mousebutton Down State



elimin8tor
03-05-2002, 06:23 AM
Hi, how can I find out if the mouse button is down without using the Win32 API (WM_LBUTTONDOWN).

I want the whole program to be portable so I'd like the glut state.

I know of glutMotionFunc, but that is only called if you move the mouse while pressing the button.

Thx

nexusone
03-05-2002, 06:40 AM
Here is the spec's on glutMouseFunc http://www.opengl.org/developers/documentation/Specs/glutspec3/node50.html?glutMouseFunc#first_hit

glutMouseFunc(int button, int state, int x, int y)

state is button up GLUT_UP or down GLUT_DOWN.

example:

mouse(int button, int state, int x, int y)
{

if ((button == GLUT_LEFT_BUTTON ) && (state == GLUT_DOWN))
{
Do something when the left button is pressed!
called only on state change.
}

if ((button == GLUT_LEFT_BUTTON ) && (state == GLUT_UP))
{
Do something when the left button is released.
}
Hope this helps..

http://www.opengl.org/discussion_boards/ubb/smile.gif


Originally posted by elimin8tor:
Hi, how can I find out if the mouse button is down without using the Win32 API (WM_LBUTTONDOWN).

I want the whole program to be portable so I'd like the glut state.

I know of glutMotionFunc, but that is only called if you move the mouse while pressing the button.

Thx