Game Development Community

Capturing Mouse events in game

by Veynom · in Torque Game Engine · 03/12/2006 (1:07 pm) · 1 replies

Im still trying to figure this one out see here for earlier posts
http://www.garagegames.com/mg/forums/result.thread.php?qt=41263

I keep trying different things but nothing seems to work. All I want to do is leave the cursor ON in game and be able to move the camera and caputre mouse events. I've tried messing with just about every file that has to do with it with no success. right now I'm trying to create a new type of GUI control and try overlaying that on the HUD but my C++ knowledge is a little lacking and I can't get it to compile.

my question is: WHY is it that mouse events stop being captured when the cursor is gone? Is it purposely being stopped, or is there just no code there to capture the events? my goal is to make like a menu bar for like spells and stuff, but everything I've tried hasn't worked.

#1
03/12/2006 (3:10 pm)
In PlayGUI.cs there is this function at the beginning:
function PlayGui::onWake(%this)
{
   // Turn off any shell sounds...
   // alxStop( ... );

   $enableDirectInput = "1";
   activateDirectInput();

   // Message hud dialog
   Canvas.pushDialog( MainChatHud );
   chatHud.attach(HudMessageVector);

   // just update the action map here
   moveMap.push();
   
   // hack city - these controls are floating around and need to be clamped
   schedule(0, 0, "refreshCenterTextCtrl");
   schedule(0, 0, "refreshBottomTextCtrl");
}

comment out the line
activateDirectInput();
and change
$enableDirectInput = "1";
to
$enableDirectInput = "0";

that should do it.

EDIT: Maybe it won't I just tested it and it didn't work. You need to do something with the DirectInput functions I think