Game Development Community

No event on mousebutton - windowed mode

by Jendrik Posche · in Torque Game Engine · 02/18/2009 (5:02 am) · 3 replies

when playing the game in windows mode, I came across the following problem.

When holding a mouse button pressed, you leave the window. And release the mouse button. And re-enter the window again. No event is triggered and TGE1.5.2 still thinks that the button is pressed.

How can I trigger a mousebutton event when the mouse is outside the window and the player releases the button

#1
02/18/2009 (6:02 am)
Btw.

I added WM_MOUSELEAVE and WM_NCMOUSELEAVE in the OurDispatchMessages() loop and on other places as well. The weird thing is that they are never reached. However WM_MOUSEMOVE and WM_NCMOUSEMOVE are reached, so why not WM_MOUSELEAVE/NCMOUSELEAVE

Greets
#2
02/18/2009 (9:38 am)
Ok got it, add just add:

TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = winState.appWindow;
TrackMouseEvent(&tme);

in the case WM_MOUSEMOVE:
and add WM_MOUSELEAVE/WM_NCMOUSELEAVE of course ...
#3
02/18/2009 (9:43 am)
Other problem still remains, when pressing a mouse button and release it when it leaves the window and returning back in the window, torque still thinks the mouse buton is pressed.

I used ReleaseCapture() and mouseButtonEvent(SI_BREAK, KEY_BUTTON0); to no avail