Game Development Community

Controlling Mouse Right Click

by JohnT · in General Discussion · 06/05/2005 (5:33 am) · 9 replies

I am using Torque in an unusual way that I need to take control of the game in runtime and permit players to click on buttons at runtime in the playGui dialog using the mouse.

I have mapped the right mouse button and use CursorOn() to take control and everything looks good except when the player clicks the right mouse button again it never gets routed to the same handler so that I can execute the CursorOff().

Hope someone has an idea on how to do this since one of my design goals for this project is to not need to use the keyboard since the completed project will be used for presentations and speakers hate to use keyboards when in front of groups!

Thanks,
John

#1
06/05/2005 (10:47 am)
I require similar functionality for the project I am working on.

Today, I was going to go into the engine and look into how to capture Right mouse clicks since it seems that onMouseDown of GUI controls only captures left clicks (at least, it seems that way to me).

If it isn't imperative to have the right mouse button do this, you can always follow the onMouseDown changes in the Object Selection tutorial, then you can use left mouse button, but it will only work when you are not over a GUI control (which sounds like it should work).

Since this would require engine changes, I cannot give specific code code (due to the forum this is in).

Robert
#2
06/05/2005 (11:07 am)
It's actually fairly easy to capture the right clicks and in fact for my game I've got left/middle/right all working just fine though there are a few different and key places where additions need to be made in the engine.

Is this worth a resource or should I just summarize and post here? (I won't be able to do either until later on tonight though.)
#3
06/05/2005 (11:20 am)
I say you should do both, but it is your choice, :).

Robert
#4
06/05/2005 (12:52 pm)
Actually,. please post a resource. This post is in the wrong forum (should be in a Torque specific forum, and a private forum since code would be posted), and a resource would make sure the code gets to the right audiences!
#5
06/05/2005 (3:14 pm)
Sorry about posting this in the wrong area, I'll need to watch that next time.

Thanks for all the suggestions on this question, I look forward to seeing this as a new resource and believe that it will be of use to many Torque developers.

John
#6
06/07/2005 (5:05 pm)
I've been looking to see if any resource was added to the GarageGames database to handle the mouse clicks but cannot locate it. If it has, can someone point me in the right direction?

Thanks,
John
#7
06/07/2005 (6:40 pm)
I'm in the process of writing up a complete resource for applying left/middle/right clicks to the game. Sadly RealLife has taken it's toll on me in these past few days.

However, I could use a little help...

What I need to know is exactly how do you all want to use these clicks?

Some examples to get things started:

* General GUI events
* in the PlayGUI itself (ie: right clicking on the terrain and having access to the vector of the click)
* double/tripple clicking
#8
06/07/2005 (10:50 pm)
I would like to see all of the things you listed, :P.

Robert
#9
06/08/2005 (9:35 am)
These all sound great, I'd be thrilled with just being able to route the click event back to the script after setting the cursor to on...

Anything else is greatly appreciated!

John