Skip to main content
GameDev.net gamedev.net
🔒 Locked

GLUT - using the "mouse wheel"

Started by leo77 Apr 1, 2005 at 9:53 AM 0 replies 27.5k views
Original Post
leo77
leo77
Hi... How can I access the mouse wheel button using GLUT for Windows?
Leo
Drew_Benton
Drew_Benton
From what I've seen, the *latest* version of the Win32 port of GLUT does not have the scroll button functionality. After a little looking I've come across this. It is an updated version of GLUT that has it built in. You will want to get the "GLUT 3.7.6 Binary (DLL+Lib)" package.

Now you need to install it. Make sure to copy over the new .dll into your system32 diretory or equivilant if you are not on XP. Make sure to move the library file to where the old one was and overwrite it.

Once you do all of that you can use it like this:

// Our mouse callback function called in the main functionglutMouseFunc(processMouse);......void processMouse(int button, int state, int x, int y) {    // Used for wheels, has to be up	if (state == GLUT_UP )	{		if ( button == GLUT_WHEEL_UP )		{			printf("Wheel Up\n");		}		else if( button == GLUT_WHEEL_DOWN )		{			printf("Wheel Down\n");		}	}}


And that's it! If you have any troubles with that feel free to ask. It should work right away, I just tried it to be sure. Good luck!

- Drew

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.