Game Development Community

Mouse buttons

by Gavin Beard · in Torque Game Builder · 03/24/2008 (4:11 am) · 6 replies

Hi all

Sorry for barrage of stupid questions, but is the a method or Field of a Scene Window to check if a mouse button is currently pressed rather than having to use callbacks to set a custom variable to check for mouse presses?

ta

#1
03/28/2008 (12:56 am)
OK,

thinking i may 'try' to make a source code modification, just to add method to SceneWindow2D, something like isMouseButtonDown(int button) which returns a true or false depending on states, i'm not brilliant at c++ but would this be quiet simple?
#2
03/28/2008 (1:27 am)
Why no just do something like this:

function t2dSceneWindow::onMouseDown(%this)
{
    $MouseDown = true;
}
 
function t2dSceneWindow::onMouseUp(%this)
{
    $MouseDown = false;
}
#3
03/28/2008 (2:34 am)
Would $MouseDown need to be set as a global variable at some point for this?
#4
03/28/2008 (6:29 pm)
The first time you assign it, it is created as a global variable. You could set $MouseDown = FALSE in your initialization to be more 'complete' but it is not required.

Greg
#5
03/29/2008 (6:55 pm)
A source mod seems extreme for something that could be easily done in script as Phillip has suggested. If you got some extra time on your hands, though; go for it!
#6
03/31/2008 (8:39 am)
Lol,

ok, couldnt figure via source mod so went with suggestion from Phillip :-)

now all works ok, although to get map scrolling properly when holding right mouse button i had to stop using onMouseMove and change on to onRightMouseDragged


ta