Complete Guide to Torque X (GUI Problem)
by George Gibson · in Torque X 2D · 09/23/2008 (12:55 pm) · 1 replies
I just got my copy of "The Complete Guide to Torque X" by John Kanalakis a few days ago. Thus far, a GREAT work that already given me much more understanding of the Torque X engine and how it's various components work together. However, I've run into one problem; it could very well be something I've overlooked.
On page no. 339 and 340 cover 'Creating the Game Play Screen' and 'Adding Text to the Play Screen'. I've created a new class and set it up as instructed, but where you're supposed to create the gui style I'm having trouble. The book has the following code:
The problem is that last line: playStyle.Anchor = AnchorFlags.All;
There is no .Anchor option under the GUIStyle class.
Also, on page no. 340, where you add text to the play screen, the following code is supposed to be added:
The last line there is the problem. It appears that GUITextStyle.TextColor is read only and cannot be set.
Needless to say, I haven't been able to add a score board to my little test game :( I was wondering if someone might have some information on this; any help is much appreciated!
Thanks,
George
On page no. 339 and 340 cover 'Creating the Game Play Screen' and 'Adding Text to the Play Screen'. I've created a new class and set it up as instructed, but where you're supposed to create the gui style I'm having trouble. The book has the following code:
// create the Style for our play screen GUIStyle playStyle = new GUIStyle(); playStyle.Anchor = AnchorFlags.All;
The problem is that last line: playStyle.Anchor = AnchorFlags.All;
There is no .Anchor option under the GUIStyle class.
Also, on page no. 340, where you add text to the play screen, the following code is supposed to be added:
//add controls directly into the playing gui GUITextStyle textStyle = new GUITextStyle(); textStyle.FontType = "arial16"; textStyle.TextColor = Color.White; ...
The last line there is the problem. It appears that GUITextStyle.TextColor is read only and cannot be set.
Needless to say, I haven't been able to add a score board to my little test game :( I was wondering if someone might have some information on this; any help is much appreciated!
Thanks,
George
Torque Owner Scott Goodwin
GUIStyle Anchor has been replaced by GUIControl HorizSizing and VertSizing
public enum HorizSizing { /// <summary> /// The control will be fixed on the left side and in width. /// </summary> Right = 0, /// <summary> /// The control will be fixed on the left side and right side. /// </summary> Width, /// <summary> /// The control will be fixed on the right side and in width. /// </summary> Left, /// <summary> /// The control will stay centered horizontally to parent. /// </summary> Center, /// <summary> /// The control will resize relative to parent. /// </summary> Relative, } public enum VertSizing { /// <summary> /// The control will be fixed on the top side and in height. /// </summary> Bottom = 0, /// <summary> /// The control will be fixed on the top side and bottom side. /// </summary> Height, /// <summary> /// The control will be fixed on the bottom side and in height. /// </summary> Top, /// <summary> /// The control will stay centered vertically to parent. /// </summary> Center, /// <summary> /// The control will resize relative to parent. /// </summary> Relative, }GUITextStyle.TextColor is now a ColorCollection. Use it like this: