Overlapping t2dSceneWindows and mouse input
by WesTT · in Torque Game Builder · 12/30/2007 (7:35 pm) · 11 replies
Hi everyone, I have a problem with my game and I am hoping someone could help me. I currently have the standard sceneWindow2d displaying my game level, and a HUD scene window (hudWindow2D) overlapping it to display readouts, ammo, life etc. I wish to have the primary level scene window receive mouse callbacks, but whenever the HD scene window is present it appears to intercept all mouse inputs and my main player object receives no mouse callback msgs (onMouseMove etc) as it is a member of the sceneWindow2d scenegraph.
In my mainScreen.gui file, the hudWindow2d definition has the following parameters defined:
lockMouse = "0";
useWindowMouseEvents = "0";
useObjectMouseEvents = "0";
I have tried changing these to true, but to no avail. What else could I try besides bind mouse input directly to the player?
EDIT: Also, I am using a behavior to control the player character. I am using a trackMouse behavior where I have implemented onMouseMove(%this, %modifier, %worldPos) which is never called due to the overlapping issue I am having.
Cheers
In my mainScreen.gui file, the hudWindow2d definition has the following parameters defined:
lockMouse = "0";
useWindowMouseEvents = "0";
useObjectMouseEvents = "0";
I have tried changing these to true, but to no avail. What else could I try besides bind mouse input directly to the player?
EDIT: Also, I am using a behavior to control the player character. I am using a trackMouse behavior where I have implemented onMouseMove(%this, %modifier, %worldPos) which is never called due to the overlapping issue I am having.
Cheers
#2
I had considered this, but it seemed easier to simply use a second t2dSceneWindow for the HUD components... until of course I needed the one below it to interface with the mouse. I'll look into that.
Thanks for your input.
12/30/2007 (10:05 pm)
Ahh. So (and correct me if I am wrong) what you are saying is to use a seperate GUI file for the HUD, and simply set that as the active GUI while the game is playing, which will display the HUD?I had considered this, but it seemed easier to simply use a second t2dSceneWindow for the HUD components... until of course I needed the one below it to interface with the mouse. I'll look into that.
Thanks for your input.
#3
Reading a tutorial on GUI building (http://tdn.garagegames.com/wiki/TGB/MiniTutorials/GUIScoreAndTime) I was able to set the second overlapping scene windows profile to "GuiModelessDialogProfile", this allows mouse events to click through to the sceneWindow2d below. :)
Thanks again, you're words made me start looking into the GUi builder.
12/30/2007 (10:51 pm)
Hi again. Actually, I just managed to solve my problem:Reading a tutorial on GUI building (http://tdn.garagegames.com/wiki/TGB/MiniTutorials/GUIScoreAndTime) I was able to set the second overlapping scene windows profile to "GuiModelessDialogProfile", this allows mouse events to click through to the sceneWindow2d below. :)
Thanks again, you're words made me start looking into the GUi builder.
#4
12/31/2007 (6:25 am)
For what it's worth, I went back and fixed our code as well using "GuiModelessDialogProfile" on the GuiControl. Then, I'm using "GameGui.add(TestGui)" and things seem alright. I'm not a GUI expert, but I'd like it if we could share notes on GUI items sometime.
#5
12/31/2007 (11:33 pm)
Sure, that would be cool. Problem is, I am only just getting started with GUIs, and perhaps have less experience than yourself! :P
#6
06/27/2008 (12:24 pm)
Sorry to jump in long after this thread seems to solved both of your problems but it raised a question or two for me. If I get it right what both of you did was create a second scenegraph to overlay as your gui/hud, wich is what I've been considering due to my dificulty with the gui system as it stands. So I'm guessing I'll have to add the second scenegraph through code, since I tried adding a second one through the gui editor only to be unable to add anything to it. And I'm trying to figure out where exactly I do that.
#7
06/27/2008 (5:52 pm)
You can add a second scene window in mainscreen.gui. To add a second scene graph, you'd need a second scene window. It's a one-to-one relationship.
#8
06/28/2008 (10:56 am)
Yeah I got that part done through the gui editor but then I couldn't use the level editor to add objects to the second scene window. Thats the part I figured I would have to do through code.
#9
06/30/2008 (10:47 am)
The level editor doesn't "modify" a specific sceneGraph, it just creates level (.t2d) files. If you want to load a specific level file in your second scenegraph, just give the sceneWindow a name in your gui and do ... sceneWindowName.getSceneGraph().loadLevel(....);
#10
07/02/2008 (7:25 pm)
Thank you very much James that made my life so very very much easier.
#11
07/02/2008 (11:09 pm)
Thank you very much James that made my life so very very much easier.
Torque 3D Owner Jason Ravencroft