Game Development Community

Question about Game Play Screen tutorial: Complete Guide to Torque X

by Arden · in Torque X 2D · 09/22/2010 (1:37 pm) · 3 replies

Hey guys, hopefully I have a rather simple question about page 339 - 340 of John's book, about creating a Game Play Screen. Here is the code, I've commented the changes I made for it to work:

public class GuiPlay:GUISceneview,IGUIScreen
{
    public GuiPlay()
    {
        //create the Style for our play screen
        //GUIStyle playStyle = new GUIStyle();
        //playStyle.Anchor=AnchorFlags.All; // this as I understand is not valid anymore 
        GUIControl playStyle = new GUIControl(); //these are the lines I replaced it with
        playStyle.HorizSizing = HorizSizing.Center;//these are the lines I replaced it with
        playStyle.VertSizing = VertSizing.Center;//these are the lines I replaced it with


        // set some info for this control
        Name = "GuiPlay";
        Style = playStyle; ;//this now gives me an error (cannot implicitely convert)
        Size= new SizeF 800,600); // replaced SizeF with Vector2. 
     }
}

So my question is, do I even need the GUIStyle anymore, and if so, what further changes do you think I should make to the code for creating the Game Play Screen?

Thanks for any help!


#1
09/22/2010 (5:46 pm)
I dont have the Torque X book, but the project template "TorqueX GUI 2D (3.1.5) Pro" has all of these goodies already setup for you ;-) If the goal is not to use the GUI template, you could still make a new GUI project to gain example code.

Best Regards,
#2
09/23/2010 (2:46 pm)
hey I made the same discoveries, the book is outdated but if you downloaded the files from the website listed in the book. it will have the correct/updated version, you can easily see the differences and work from there
#3
09/23/2010 (4:33 pm)
Yeah, found it too. I wish I'd looked at that code earlier, but then again allowed me to learn the hard way :)