GUIUtil Alternative?
by Do Not Delete · in Torque X 2D · 04/21/2008 (10:09 pm) · 10 replies
Seems like GUIUtil doesn't work anymore in Torque X 2.0.
Whats an alternative we can use??
Here is the line of code:
Whats an alternative we can use??
Here is the line of code:
GUIUtil.InitGUIScreens("StarterGame.UI");About the author
#2
04/22/2008 (3:37 pm)
I don't have a pro. What should I do?
#3
Try requesting it be added. I don't see any reason why it was removed. The fix is just a matter of copying the class from the 1.0 Util.cs to the 2.0 Util.cs. For those with Pro, it's easy to do. For those without, the only hope is GG added it in the next release.
04/22/2008 (3:45 pm)
@DroTry requesting it be added. I don't see any reason why it was removed. The fix is just a matter of copying the class from the 1.0 Util.cs to the 2.0 Util.cs. For those with Pro, it's easy to do. For those without, the only hope is GG added it in the next release.
#4
04/22/2008 (4:21 pm)
Wow. This is one of the worse releases that GG has done :(.
#5
04/22/2008 (5:19 pm)
All you have to do is instantiate your GUI classes. I was wondering where that method went also but I just went ahead and just new'd them myself and everything worked. So I think the InitGUIScreens method just instantiates them and thats it.
#6
04/22/2008 (5:51 pm)
InitGUIScreens doesn't exist. Can you post some code so I can get a better understanding?
#7
In other words, it automatically creates an instance of any class defined with the IGUIScreen interface.
You can manually create instances yourself with new.
04/22/2008 (7:12 pm)
All InitGUIScreens does is/// Using reflection, call the constructor to any classes implementing /// the IGUIScreen interface within the namespace provided.
In other words, it automatically creates an instance of any class defined with the IGUIScreen interface.
You can manually create instances yourself with new.
#9
At the point in the code where you have,
This creates instances of all classes in the namespace StarterGame.UI that have the IGUIScreen interface. You can replace this line by ones that create new instances of these classes. I don't know what classes are in your StarterGame.UI, but as an example suppose there was a class defined like this:
Now you would replace the call to InitGUIScreens with something like
Then you also have to define the field _mainMenuGUI
Of course, this is just an example, and you would have to replace it by the gui classes in your example.
04/22/2008 (8:22 pm)
@DroAt the point in the code where you have,
GUIUtil.InitGUIScreens("StarterGame.UI");This creates instances of all classes in the namespace StarterGame.UI that have the IGUIScreen interface. You can replace this line by ones that create new instances of these classes. I don't know what classes are in your StarterGame.UI, but as an example suppose there was a class defined like this:
public class MainMenuGUI : GUIBitmap, IGUIScreen
{
// etc
}Now you would replace the call to InitGUIScreens with something like
_mainMenuGUI = new MainMenuGUI();
Then you also have to define the field _mainMenuGUI
MainMenuGUI _mainMenuGUI;
Of course, this is just an example, and you would have to replace it by the gui classes in your example.
#10
04/22/2008 (9:00 pm)
Oh okay, thanks :D
Torque Owner Scott Goodwin