Game Development Community

Binding mouse left+right button

by Tom Spilman · in Torque Game Engine · 05/11/2006 (6:50 pm) · 8 replies

I have a client that wants to trigger commands on two mouse buttons being clicked simultaneously, so i'm starting to ponder what i need to do to achieve it.

Having it appear as a unique input event would actually be quite convenient. It would be easily mappable via the gui without any craziness in default.bind.cs. The issue is how to detect the difference between successive clicks and both down at the same time. It seems you would need to delay the mouse button event by a couple of ticks to decide, but it would lag the input system for mouse clicks.

Another idea is to extend the action map for special multi-input event bindings. The script would look like this...

moveMap.comboBind( "mouse button0 + mouse button1", 100, doSpecialCombo);

The string is each device/event separated with a plus if they keys occur at the same time or a comma if they need to occur in sequence. The second parameter is a a time limit in milliseconds before the combo is considered to be failed. The final parameter is the function to call when the combo is hit. This seems like a pretty solid idea... i like this one, but how do i allow one to map combos to remaps in the options dialog.

Any other ideas?

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.


#1
07/03/2006 (5:50 pm)
Posting: Unread posting for more than 30 days. I am posting to help get a reply to your un-answered question.
#2
07/03/2006 (10:24 pm)
.
#3
07/04/2006 (8:54 am)
That's a interesting solution... thanks for sharing it.

In the end i just hacked something into the C++ side mouse event handler. The client checked it out and didn't like the feel of the double mouse press and i removed the hack. Still maybe this post will help someone in the future.
#4
07/04/2006 (5:19 pm)
.
#5
07/04/2006 (8:28 pm)
I just didn't try to do it in TorqueScript because i already had some fairly complex mouse button handling there as it was. I could have done it there as well if i tried, but the feature is no longer needed.
#6
07/06/2006 (7:59 am)
.
#7
07/06/2006 (10:22 am)
Sorry... cannot say details as i'm under NDA. ;)
#8
07/07/2006 (12:11 am)
.