Game Development Community

GUIControl layers

by T. Chamill · in Torque X 2D · 10/02/2008 (9:55 am) · 2 replies

Hey folks.

I have a menu system that moves between various GUIControl menus, such as main menu, options screen, etc.
I've also got a T2DStaticSprite object that acts as a mouse pointer, with the real pointer being hidden.

The problem is, no matter what I set the GUIControl layers to, the mouse pointer appears behind them. For example, the mouse pointer has layer = 0, and the main menu has layer = 1 (or anything higher than 0), but the mouse pointer appears behind the menu.

Thinking it might be the object in the menu rather than the menu itself, I tried changing the layers of the GUIBitmaps, GUIText fields, and so on, also to no avail.

One interesting thing of note, if I set the options screen layer to something higher than 0, go to the options screen, and then go back to the main menu (with the main menu layer still at 0) the mouse pointer will appear above the items on the main menu. However, the options menu items (text, buttons, etc.) will be overlaid on the main menu, and the mouse pointer will get hidden by them.

If I mark the GUIControl for the options menu for delete after returning to the main menu, the overlay problem goes away, but the mouse pointer is once again under the main menu.

Is there a way I can force a particular object to always appear on top of GUIControl objects?

#1
10/02/2008 (9:19 pm)
Scene objects are always rendered before the GUIControls. You can't make them appear on top of GUIControls without rewriting the OnRender method in GUICanvas and/or GUISceneview.
#2
10/03/2008 (8:13 am)
Ah, that explains it then. Thanks for the info Scott.