Game Development Community

In game dialog windows(like a pause menu)?[SOLVED]

by Kevin French · in Torque X 2D · 08/26/2010 (1:42 pm) · 4 replies

Hi all!

I'm new to the TorqueX 2D scene. I've been working with XNA directly for a little over a month now and have a good handle on how it works. I remembered that GG had an XNA version of there TGB. So, I am now messing around and evaluating. So far, I like it alot.

But, now I am stuck on something. How do you create an in game dialog window? I figured out some of the GUI system. I even have a message displaying/hiding when I press a button. My problem is I can't figure out how to use a bitmap to make it look like the message is being displayed in a window. If you have ever played any old console Japanese style RPGs, I'm trying to figure out how to display a character speaking style of dialog. I've searched the forums with no luck so far. I'm not sure if it is the search engine or if my search-fu sucks.

Thanks in advanced for any pointers.


Well, after playing around and re-reading the docs on the GUI that I found. I was able to figure it out.
The key, and I am not 100% sure this is the correct way of doing things, was to create an empty GUIControl (I created a class that inherited from it) and then add the various GUIBitmaps, GUIButtons, etc to that control by setting the FOLDER property to the GUIControl. Worked like a charm. If anyone is interested, I can post my code.

#1
01/07/2011 (11:42 pm)
I like your solution to this problem, but now I have a different problem. Once I add my custom GUI control to the screen, it displays, but my game still has the focus and I can move my character around. Additionally, any functionality I have on my pause screen is failing to work. I cannot move between the options and I cannot find out how to make the pause screen go away. Does anyone have a solution to this?
#2
01/09/2011 (7:07 am)
What I always do to make a GUI element disapear is assign it's folder to a new Folder(), this makes it go away.
#3
01/11/2011 (3:45 pm)
If you guys are looking for an easy way to make your screen show up and have focus, simply use GUICanvas.Instance.PushDialog(layer, guicontrol) on the base GUIControl that you put everything inside. Other than that you've got it bang on Kevin.

Then when you want to hide it, use GUICanvas.Instance.PopDialogControl(guicontrol).

This will give your buttons focus.

Your game might still respond to buttons though. For this I simply have a global GameState in my Game.Instance. I switch it to Menu and check for it wherever I have my button presses. If GameState != Playing (I use an enum) then it just skips my button code.
#4
04/04/2011 (3:38 pm)
Kevin,
If you don't mind, I'm interested in your code or the way you made this work. I am currently working on a project and my current problem is how to pop up a menu when the player levels up and have the game pause.

Canvas.pushDialog(<gui>) only pops the message but doesn't pause the game, I tried your solution but the buttons I made were not showing.

Thank you in advance
-Andrei