"modal" doesn't work in Torque2D 1.8
by Michal 'Doc' Kubek · in Torque Game Builder · 03/26/2013 (10:49 am) · 5 replies
Hi,
I was working on my game using Torque2D 1.7.5 and few days ago I switched to 1.8
After that, I have a problem with passing mouse events through the snowSceneWindow to my mainSceneWindow (both with loaded scenegraphs). If snowSceneWindow visibility is setted to false, mouse events is working in mainSceneWindow. In 1.7.5 this works well but now I can't pass mouse events through any visible t2dSceneWindow object. Why is it not possible in Torque2D 1.8 ??
Please help I'm confsed about that & thank you for response.
I was working on my game using Torque2D 1.7.5 and few days ago I switched to 1.8
After that, I have a problem with passing mouse events through the snowSceneWindow to my mainSceneWindow (both with loaded scenegraphs). If snowSceneWindow visibility is setted to false, mouse events is working in mainSceneWindow. In 1.7.5 this works well but now I can't pass mouse events through any visible t2dSceneWindow object. Why is it not possible in Torque2D 1.8 ??
Please help I'm confsed about that & thank you for response.
//in mainScreen.gui
%guiContent = new GuiControl(mainScreenGui) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiBlackContentProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
new t2dSceneWindow(sceneWindow2D) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiContentProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
lockMouse = "0";
useWindowMouseEvents = "1";
useObjectMouseEvents = "1";
};
new t2dSceneWindow(mainSceneWindow) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "MySceneGuiProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
lockMouse = "0";
useWindowMouseEvents = "0";
useObjectMouseEvents = "1";
};
new t2dSceneWindow(snowSceneWindow) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "MySceneGuiProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
lockMouse = "0";
useWindowMouseEvents = "0";
useObjectMouseEvents = "0";
};
...
};
//and guiProfiles added (or using guiDefaultProfile)
if(!isObject(MySceneGuiProfile)) new GuiControlProfile("MySceneGuiProfile")
{
modal = true;
};
#2
but it isn't that. I used it in T2D 1.7.5 and it works well. Even though I fixed it. It still doesn't work, while I don't set visible to false for each t2dSceneWindow above mainSceneWindow...
03/26/2013 (11:54 am)
Thanks Doc308,but it isn't that. I used it in T2D 1.7.5 and it works well. Even though I fixed it. It still doesn't work, while I don't set visible to false for each t2dSceneWindow above mainSceneWindow...
#3
If you're looking for general onMouseDown, etc.. events, then you'll need to set useWindowMouseEvents to be true.
I'm not sure why you need stacking SceneWindows, but you could try to limit the area as well.
03/26/2013 (1:09 pm)
Which mouse events are you seeking to capture?If you're looking for general onMouseDown, etc.. events, then you'll need to set useWindowMouseEvents to be true.
I'm not sure why you need stacking SceneWindows, but you could try to limit the area as well.
#4
The reason of stacking sceneWindows is for snowing effect in the game, loading many differebt popUp windows, dialogs, messages.. I don't know, if this is the best way. I tried to do it through gui editor but it was very dificult (not practical using res. 1280x768) and it's much more easy to load only a new scene level to same sceneWindow. (it's adventure/hidden objects/logical game)
Also, this stacking of sceneWindows is the biggest issue for me. The problem is in performance. When game starts, some level.t2d is loaded into sceneWindow2D, next is loaded inventory into other sceneWindow. This decrease FPS to the half. So when is popUp level loaded to the next sceneWindow (sometimes +dialog and +hint), the performance is totaly bad (for my requirements of low performance PCs).
Is there any different way to solve this "stacking sceneWindows"? I realy need to solve this issues, so please please help. Thanks!
03/27/2013 (4:54 pm)
I use windowMouseEvents in sceneWindow2D like sceneWindow2D::onMouse... ObjectMouseEvents are used in other t2dSceneWinows (I need this events in other sceneWindows). From my experience, only one of the sceneWindows (bottom) can have windowMouseEvents setted to true, else mouseEvents don't work..The reason of stacking sceneWindows is for snowing effect in the game, loading many differebt popUp windows, dialogs, messages.. I don't know, if this is the best way. I tried to do it through gui editor but it was very dificult (not practical using res. 1280x768) and it's much more easy to load only a new scene level to same sceneWindow. (it's adventure/hidden objects/logical game)
Also, this stacking of sceneWindows is the biggest issue for me. The problem is in performance. When game starts, some level.t2d is loaded into sceneWindow2D, next is loaded inventory into other sceneWindow. This decrease FPS to the half. So when is popUp level loaded to the next sceneWindow (sometimes +dialog and +hint), the performance is totaly bad (for my requirements of low performance PCs).
Is there any different way to solve this "stacking sceneWindows"? I realy need to solve this issues, so please please help. Thanks!
#5
It really depends on what you are trying to accomplish in the end.
For instance, your snowing effect, could be some particle emitters set to a layer behind every other element (or varying depths, depending..).
Now based on the info you provided it makes a certain amount of sense to have your sceneWindow2D as your holder for all elements, and have your mainSceneWindow stacked on top for user selection.
As for the popUp Windows, dialogs, etc.. Would it be possible to have an area of your screen set up for that alone? Like I mentioned, limiting a scene window on top of everything else to a certain area. That way it doesn't constict game play, and gets away from troublesome gui (though that would be an easy solution as well, if you're knowledgable enough with Gui elements)
I believe each sceneWindow represents a new "rendered scene", so you're going to take a hit with multiple sceneWindows more so, that say placing a gui element control, or having objects within a given sceneWindow. Like I mentioned, I've seen a top sceneWindow used for something simple like a flash effect over the window, but it's usally quick and doesn't persist long term.
I'm not sure if all of this was helpful or not to you, I've been devoting my time towards the new T2D, but I have a long background using TGB. Hopefully some of it helps you though. You may want to test out switching the windowMouseEvents and objectMouseEvents and just use echos on each sceneWindow to see what is 'working'.
03/27/2013 (7:46 pm)
Stacking sceneWindows on top of one another will "essentially" cancel out whatever is behind them for event calls, unless you carry the event passing through. From what I've seen, they can be useful for quick effects, but other than that, you should be able to do what you need without stacking up sceneWindows.It really depends on what you are trying to accomplish in the end.
For instance, your snowing effect, could be some particle emitters set to a layer behind every other element (or varying depths, depending..).
Now based on the info you provided it makes a certain amount of sense to have your sceneWindow2D as your holder for all elements, and have your mainSceneWindow stacked on top for user selection.
As for the popUp Windows, dialogs, etc.. Would it be possible to have an area of your screen set up for that alone? Like I mentioned, limiting a scene window on top of everything else to a certain area. That way it doesn't constict game play, and gets away from troublesome gui (though that would be an easy solution as well, if you're knowledgable enough with Gui elements)
I believe each sceneWindow represents a new "rendered scene", so you're going to take a hit with multiple sceneWindows more so, that say placing a gui element control, or having objects within a given sceneWindow. Like I mentioned, I've seen a top sceneWindow used for something simple like a flash effect over the window, but it's usally quick and doesn't persist long term.
I'm not sure if all of this was helpful or not to you, I've been devoting my time towards the new T2D, but I have a long background using TGB. Hopefully some of it helps you though. You may want to test out switching the windowMouseEvents and objectMouseEvents and just use echos on each sceneWindow to see what is 'working'.
Torque Owner Doc308
You are disabling ObjectMouseEvents in snowSceneWindow.. so of course they won't work.
new t2dSceneWindow(snowSceneWindow) { ... useObjectMouseEvents = "0"; //This disables the mouse response useObjectMouseEvents = "1"; //Will enable the mouse events (at least on objects) };