[T3D 1.1 Beta 3] no longer get the mouse button up event - RESOLVED
by Enel · in Torque 3D Professional · 02/04/2011 (6:57 pm) · 12 replies
Build: 1.1 Beta 3
Platform: Windows XP, 32
Target : PlayGui ( Play Control )
Issue : mouse button up event dosent work
Steps to Repeat:
1. move Default.bind.cs
2. remove this code
3. and move PlayGui.gui
4. add this code end of line
5. in script you should be breakpoint onRightMouseUp,onRightMouseDown event
6. Launch the game
7. right Click
8. onRightMouseDown, onRightMouseUp event dosent called.
P.S sorry for reported again but i just need hide/show mouse button
if you want to need more info. check last comment
more info here
Platform: Windows XP, 32
Target : PlayGui ( Play Control )
Issue : mouse button up event dosent work
Steps to Repeat:
1. move Default.bind.cs
2. remove this code
function mouseFire(%val)
{
$mvTriggerCount0++;
}
function altTrigger(%val)
{
$mvTriggerCount1++;
}
moveMap.bind( mouse, button0, mouseFire );
moveMap.bind( mouse, button1, altTrigger );3. and move PlayGui.gui
4. add this code end of line
function PlayGui::onRightMouseDown(%this, %pos, %start, %ray)
{
showcursor();
}
function PlayGui::onRightMouseUp(%this, %pos, %start, %ray)
{
hidecursor();
}5. in script you should be breakpoint onRightMouseUp,onRightMouseDown event
6. Launch the game
7. right Click
8. onRightMouseDown, onRightMouseUp event dosent called.
P.S sorry for reported again but i just need hide/show mouse button
if you want to need more info. check last comment
more info here
About the author
Recent Threads
#2
it is little clue :)
03/04/2011 (5:04 am)
all of input action depends on this function//-----------------------------------------------------------------------------
// Process an input event and pass it on.
// Respect the action map.
//-----------------------------------------------------------------------------
void WindowInputGenerator::generateInputEvent( InputEventInfo &inputEvent )
{
if( !mInputController || !mFocused )
return;
// Give the ActionMap first shot.
if (ActionMap::handleEventGlobal(&inputEvent))
return;
if( mInputController->processInputEvent( inputEvent ) )
return;
// If we get here we failed to process it with anything prior... so let
// the ActionMap handle it.
ActionMap::handleEvent(&inputEvent);
}it is little clue :)
#3
03/04/2011 (6:30 am)
With the cursor hidden the onRightMouseDown event still gets called but not onRightMouseUp. I think all events should still be fired, regardless of cursor visibility - let me choose what to ignore....
#4
to do this
you should be get PlayGui::onRightMouseDown ,onRightMouseUp event
03/04/2011 (8:01 am)
guiCanvas.cppGuiCanvas::GuiCanvas(): GuiControl(),
....
mForceMouseToGUI(true), // false -> true
....else if (mMouseRightButtonDown){
rootRightMouseDragged(mLastEvent);
// add this line - enel
if(!mCursorEnabled)
return false;
// end - enel
}to do this
you should be get PlayGui::onRightMouseDown ,onRightMouseUp event
#6
Here's my solution for 1.1 Final. In guiCanvas.h, add the following protected member:
In guiCanvas.cpp, add the following mAlwaysHandleMouseButtons initialization to the GuiCanvas constructor:
Add the following to initPersistFields():
Modify processInputEvent() to read as (changes in the MouseDeviceType case):
What the above does is if mAlwaysHandleMouseButtons is true (it is false by default) then all mouse buttons will be routed to the GUI rather than the ActionMap. This will happen even if the cursor is hidden. To test this out you could implement the following example in FPS Example:
1. Add to the end of createCanvas() in main.cs just before the return:
2. Set the PlayGui's noCursor=0 in art/gui/playGui.gui to have the mouse show by default.
3. Add the following to scripts/gui/playGui.cs:
Now holding down the right mouse button will rotate the player/camera. And in 3rd person, the left mouse button will rotate about the player in vanity mode.
- Dave
04/05/2011 (12:55 pm)
Greetings!Here's my solution for 1.1 Final. In guiCanvas.h, add the following protected member:
bool mAlwaysHandleMouseButtons;
In guiCanvas.cpp, add the following mAlwaysHandleMouseButtons initialization to the GuiCanvas constructor:
GuiCanvas::GuiCanvas(): GuiControl(),
mCursorEnabled(true),
mForceMouseToGUI(false),
mAlwaysHandleMouseButtons(false),
mClampTorqueCursor(true),
...Add the following to initPersistFields():
addGroup("Mouse Handling");
addField("alwaysHandleMouseButtons", TypeBool, Offset(mAlwaysHandleMouseButtons, GuiCanvas),
"Deal with mouse buttons, even if the cursor is hidden." );
endGroup("Mouse Handling");Modify processInputEvent() to read as (changes in the MouseDeviceType case):
bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent)
{
// First call the general input handler (on the extremely off-chance that it will be handled):
if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent))
{
return(true);
}
switch (inputEvent.deviceType)
{
case KeyboardDeviceType:
return processKeyboardEvent(inputEvent);
break;
case GamepadDeviceType:
return processGamepadEvent(inputEvent);
break;
case MouseDeviceType:
if (mCursorEnabled || mForceMouseToGUI ||
(mAlwaysHandleMouseButtons && inputEvent.objType == SI_BUTTON) )
{
return processMouseEvent(inputEvent);
}
break;
default:
break;
}
return false;
}What the above does is if mAlwaysHandleMouseButtons is true (it is false by default) then all mouse buttons will be routed to the GUI rather than the ActionMap. This will happen even if the cursor is hidden. To test this out you could implement the following example in FPS Example:
1. Add to the end of createCanvas() in main.cs just before the return:
Canvas.alwaysHandleMouseButtons=1;
2. Set the PlayGui's noCursor=0 in art/gui/playGui.gui to have the mouse show by default.
3. Add the following to scripts/gui/playGui.cs:
function PlayGui::onMouseDown( %this )
{
hideCursor();
$mvFreeLook = true;
}
function PlayGui::onMouseUp( %this )
{
showCursor();
$mvFreeLook = false;
}
function PlayGui::onRightMouseDown( %this )
{
hideCursor();
}
function PlayGui::onRightMouseUp( %this )
{
showCursor();
}Now holding down the right mouse button will rotate the player/camera. And in 3rd person, the left mouse button will rotate about the player in vanity mode.
- Dave
#7
This was something I was looking to do previously and that seems like a perfect solution for people!
04/05/2011 (3:11 pm)
Awesome work Dave!This was something I was looking to do previously and that seems like a perfect solution for people!
#9
After implementing this and trying your example the cursor does turn off but doesn't come back when button is released. Any ideas why? It compiled fine and no errors in the console.
Thanks
EDIT: Never mind. I accidentally had the compiler set to debug and was executing the wrong EXE.
04/14/2011 (10:17 am)
@ DavidAfter implementing this and trying your example the cursor does turn off but doesn't come back when button is released. Any ideas why? It compiled fine and no errors in the console.
Thanks
EDIT: Never mind. I accidentally had the compiler set to debug and was executing the wrong EXE.
#10
04/24/2011 (8:03 pm)
Fixed in 1.1 Final and Preview.
#11
function PlayGui::onRightMouseUp never gets called.
I tried doing:
GlobalActionMap.bind(mouse, button1, "toggleMouseLook","toggleMouseLook");
with the theory that if the actionmap was receiving the event instead then the 2nd "toggleMouseLook" would fire on mouse up, but that doesn't work either.
I want it to hide the cursor and orbit the camera when I press the right mouse down, and go back to click-to-move when I let go of the button.
08/31/2013 (4:17 am)
This seems to be broken again in T3D 3.0 MIT.. function PlayGui::onRightMouseUp never gets called.
I tried doing:
GlobalActionMap.bind(mouse, button1, "toggleMouseLook","toggleMouseLook");
with the theory that if the actionmap was receiving the event instead then the 2nd "toggleMouseLook" would fire on mouse up, but that doesn't work either.
I want it to hide the cursor and orbit the camera when I press the right mouse down, and go back to click-to-move when I let go of the button.
#12
I added:
Canvas.alwaysHandleMouseButtons=1;
to the createCanvas() function and then it works as expected :)
09/01/2013 (6:39 am)
I worked this out... the fix was as posted by Felyza here: http://www.garagegames.com/community/forums/viewthread/132649/1#comment-838730I added:
Canvas.alwaysHandleMouseButtons=1;
to the createCanvas() function and then it works as expected :)
Torque 3D Owner Bryan Sawler
muteki corporation
There have been a ton of threads about this (something I've tried implementing myself) but don't think there's been a simple/clean solution yet.