Game Development Community

GUI Problem

by Raul Martinez · in Torque Game Builder · 02/21/2013 (11:42 am) · 8 replies

Hello

I am developing a game and I have 2 GUI's and what I want to do is load it, display it and then unload it to display a second one, I am using the execute command with both GUIs but when I load the GUI it displays the last one that was executed for example I execute GUI1 and then GUI2 and when I display GUI1 it displays GUI2, what I have to do to display the GUIs no matter which one was executed last


Thank you in advance

#1
02/21/2013 (12:12 pm)
In your Gui files, when you declare your first GuiControl in each file, are you giving each one a unique name?

In the following example, the unique name goes where Name_of_Gui is written.

%guiContent = new GuiControl(Name_of_Gui)
{
...
};

Make sure that both Root controls have different names!

If that doesn't fix it, could you elaborate on the situation?

For instance, what functions are you using to display the GUI on-screen?
#2
02/21/2013 (12:40 pm)
Hello Simon

Im using canvas.pushDialog(guiname); to display the GUI and canvas.setContent(defaultgui); to display de default gui

I want this, when the player finishes a level I want to load a new level and using a GUI display a FMV and when the FMV finishes playing go to the next level and to the default gui, and depending on which level is finished display display the corresponding video

Thank you!!!!!!!
#3
02/21/2013 (1:02 pm)
Once you use Canvas.pushDialog(guiname), simply call Canvas.popDialog(guiname) to make the gui disappear.

Note that using this method, you only need to call Canvas.setContent(defaultgui) once at the beginning of the game.

The DefaultGui will always be present beneath the controls you have displayed using pushDialog().

Using your example, when the level ends, you can call
Canvas.pushDialog(FMV_Player_Gui)

Once the FMV is finished, simply call
Canvas.popDialog(FMV_Player_Gui)
#4
02/21/2013 (11:53 pm)
Hi again Simon

I hope I can explain what is happening
I made 2 GUIs and I load them at the begining of the game by calling exec("GUI1");
exec("GUI2");
In the game I call Canvas.pushDialog("GUI1"); but it displays "GUI2" it seems like its ignoring the exec("GUI1"); call

I hope you can help me, on the other hand do you know any chat where I could discuss this?

Gracias!!!!!
#5
02/22/2013 (1:05 am)
I'm really thinking that both Guis have been declared with the same Object Name.

Note that the file name (ex: Gui1.gui or Gui1.cs) is not the same as the Gui Object's Name, which is assigned when, in your .cs or .gui file, you first define it %guiContent = new GuiControl(Gui1)

The next step would be to post the contents of your .gui files.

There is an irc channel for all Torque-related questions, which you can access through any IRC client using the following info.

IRC Server: irc.maxgaming.net
IRC Port: 6667
Channel: #GarageGames
#6
02/22/2013 (7:49 am)
Simon

I'll check both things


Thank you again
#7
02/22/2013 (10:16 pm)
Simon
I checked the Gui's object game changed it and now it works like magic


Thank you
#8
02/23/2013 (1:19 am)
I knew it! :)

Glad to hear it Raul. Happy coding!