Time
by Harrison Brock · in Torque Game Builder · 08/28/2006 (1:42 pm) · 3 replies
How do you get the time that has passed from the last mouse click?
#2
08/29/2006 (9:13 am)
Thinks....What am look for is to disable the mouse for about 3 to 5 second once the mouse is click.
#3
If your mouse only interacts with a single object, you could bind to that objects onMouseUp() or onMouseDown() call back -- otherwise, if it interacts with various objects, of different classes -- you could bind to the sceneWindow's mouse callbacks, and simply keep track of the last time a click was performed -- then compare it to the current click's time and if it's too short of a time, just simply return from the callback doing nothing ... if it's after the time out period, perform the click code and update the 'last click' variable.
08/29/2006 (10:03 am)
Harrison, the pseudo-code above would do just that.If your mouse only interacts with a single object, you could bind to that objects onMouseUp() or onMouseDown() call back -- otherwise, if it interacts with various objects, of different classes -- you could bind to the sceneWindow's mouse callbacks, and simply keep track of the last time a click was performed -- then compare it to the current click's time and if it's too short of a time, just simply return from the callback doing nothing ... if it's after the time out period, perform the click code and update the 'last click' variable.
Associate David Higgins
DPHCoders.com
$MOUSE_CLICK_AT = -1; function t2dSceneWindow::onMouseUp(....) { if($MOUSE_CLICK_AT > 0) { if($MOUSE_CLICK_AT > (5 * 1000)) { // do something after mouse clicked over 5 seconds ago and mouse clicked again $MOUSE_CLICK_AT = getRealTime(); } } }