Game Development Community

additional mouse buttons

by Tom Vogt · in Torque Game Engine · 11/25/2002 (6:14 am) · 3 replies

This is a continuation of this thread. Short summary:

I want to use more than 3 buttons in Torque. The platform-dependent code defines just 3 SDL constants. Has anyone enabled more buttons? How would I best do it? What's the status for Mac and Windos on this?

#1
11/25/2002 (6:22 am)
For linux you can add this code to the case statement I talked about earlier.

default:
Con::printf("unknown mouse button pressed: %d", event.button.button);
break;

That will give you the integer value of the button event. Say its 10, then you add a case statement as follows:

case 10:
objInst = KEY_BUTTON3;
break;

I use KEY_BUTTON3 here because 0-2 are already taken. It would be better if you don't use 10 directly though, instead look for a "Button" constant in the /usr/include/X11/X.h header file.
#2
12/15/2002 (3:11 pm)
Is there a way to do that in windows too? Like I have the MS Intellimouse optical - it has 5 buttons (left, right, wheel, and one on each side). It's a very popular mouse and it would be nice to have support for those buttons.
#3
12/15/2002 (3:31 pm)
For windows, the code to look at would be winDInputDevice.cc. I just glanced at it now and it looks like it might already support this. Basically it enumerates all the "widgets" on a device in a fairly generic way, so it might already know about your extra buttons.

Direct input in torque was disabled by default last time I checked...you may need to explicitly enable it. When input is disabled it uses standard windows messages and it looks like that does have a hardcoded limit of three buttons. (Check winWindow.cc for details)