Game Development Community

Mouse events on stacked t2dSceneWindows

by J. Alan Atherton · in Torque Game Builder · 04/10/2007 (12:40 am) · 2 replies

I'm trying to do a t2d HUD over the main playing field. At the moment The HUD window is fullscreen, with some sceneobjects placed in there as HUD elements. Everything displays just fine. The problem is mouse events. Since the HUD window is the top, it gets all of the mouse events, and it totally messes up all the mouse code I have in place for the main game window.

I know I can limit the HUD to portions of the screen, but I'm wondering if there's a way I can make the top window ignore mouse events and let them fall through to the next window.

I thought about just calling the onMouseDown etc for sceneWindow2D from my hud window, but I need to have the world coordinates for the main game window, and not the hud window.

Thanks for your time!

#1
04/10/2007 (2:05 am)
You can convert from world coordinates to screen coordinates and vice-versa pretty easily, but it seems like what you need is to just use a non-modal gui profile for everything but your normal game scene window setUseWindowMouseEvents(false) on your HUD window. I'm a little rusty with TGB, but I think that should do allow all mouse events to pass right through to the lower window.
#2
04/10/2007 (8:04 am)
Thanks for the fast reply! It sounds like what I am missing is the non-modal profile. I will try that first, and if that fails I can convert between coordinates as a last resort.

For those that just tuned in, I looked into what a modal/non-modal gui profile is. In torque, a non-modal profile is defined by setting modal=false; in the profile definition. GuiModelessDialogProfile is the only default profile that has this setting. It's really easy to define your own profile... just go to common/gui/profiles.cs (I think) and have fun.

In general interface design, a modal window "is a child window, which has to be closed before the user can return to operating the parent application." (Wikipedia) So it basically hijacks the input until the user responds to it. Kinda like kids, really. And a non-modal window then would be something that can coexist with other windows happily.