Game Development Community

Mouse capture issue on window state transition

by Sim Ops Studios (#0003) · in Torque Game Engine Advanced · 09/08/2007 (1:52 pm) · 1 replies

We seem to have encountered a couple of mouse-capture issues when either running in fullscreen mode or using Alt-tab to change to another application and then back to Torque.

In both cases, we are in a first-person view. The issue we experience is that when we bring up a menu (which correctly shows and uncaptures the mouse in window mode so that it can be used to make menu selections), it shows but doesn't unbind the mouse in fullscreen mode. So we can't make menu selections because our mouse keeps snapping back to the center as if we're still in first-person control mode.

Any insight into this issue? I'm not sure which section of the engine to check for more information regarding how the engine knows when to capture the mouse for first-person camera control and when to let it operate the cursor on the 2D UI.

#1
09/08/2007 (6:03 pm)
UPDATE: We were able to isolate the problem (apparently) to a segment of code in platform/platformWin32/winInput.cpp, around line 383 (function Input::activate):

if ( GFX->getVideoMode().fullScreen )
         {
            // DirectInput Mouse Hook-Up:
            if ( dInputManager->isMouseEnabled() && smLastMouseActivated )
               dInputManager->activateMouse();
         }
         else
            dInputManager->deactivateMouse();

Commenting out the if->else block (leaving the dInputManager->deactivateMouse() line intact) seems to have solved all of our improper mouse-grabbing issues. But I can help but think that this code was doing something important... Now that we've commented this out, what doom have we brought upon ourselves?

Thank you for your help!