Linking a mission to a gui
by Freeman182 · in General Discussion · 02/19/2007 (5:15 am) · 4 replies
A group of us are building a game for our degrees at huddersfield uni and iv been assigned the gui and hud so heres my problem
im having trouble linking the main menu iv made in the gui editor to the level my friends have built in the world editor, im trying to get it loading from when i click a button but i cant figure out the command to make it work
can anybody help? or just direct me to some decent tutorials
also im having trouble with bitmaped buttons, i can get the buttons that come with torque to work but when i try to use one of my own bitmaps they dont load does anybody know why this is happening?
all coments much appreciated
im having trouble linking the main menu iv made in the gui editor to the level my friends have built in the world editor, im trying to get it loading from when i click a button but i cant figure out the command to make it work
can anybody help? or just direct me to some decent tutorials
also im having trouble with bitmaped buttons, i can get the buttons that come with torque to work but when i try to use one of my own bitmaps they dont load does anybody know why this is happening?
all coments much appreciated
#2
_n = not being touched
_h = being hovered
_i = being disabled
_d = being pushed
make sure that each of the png files for the button have the same name before the _ for it to work right.
also when you make the button, if you are using the gui editor, when you make the guibitmapbuttonctrl, make sure you are using "buttonname" and not buttonname_n.png, just the first part, the engine will determine the rest for you.
02/19/2007 (9:15 am)
Sean is right about the buttons, you might not have to have, but it uses 4 buttons. one for hover, one for disabled, one for pushed, and one for not being touched:_n = not being touched
_h = being hovered
_i = being disabled
_d = being pushed
make sure that each of the png files for the button have the same name before the _ for it to work right.
also when you make the button, if you are using the gui editor, when you make the guibitmapbuttonctrl, make sure you are using "buttonname" and not buttonname_n.png, just the first part, the engine will determine the rest for you.
#3
02/19/2007 (9:24 am)
Rich, I didn't know about _i and _d. I see that _d suffix would be the depressed state, but I'm not sure about what a disabled state would mean.
#4
02/19/2007 (11:43 am)
Sean, disabled would also mean inactive, meaning that the button cannot be pressed, (when something in a menu in windows cannot be used it is a light grey color), this allows you to do the same in torque. There is actually a forum about this topic already in the sdk private forums, I was just reiterrating it here.
Torque 3D Owner Sean H.
here's 2 typical scenarios:
1. youve got a game title screen which starts the game and a start button. for the gui, the "command" attribute is set like this:
command = "startGame();"
now, when you press the button, the startGame() function is called which creates the server, pushes the loading gui, and loads the mission.
2. youve got an options screen which sets game options and a "Save" button. for the save button, the "command" attribute is set like this:
command = "setPrefs();"
now, when you press the button, the setPrefs() function goes through every gui element, grabs the values, sets the preferences accordingly, and then pops the gui from the canvas. also, if you want something to happen when the user presses "enter" rather than pressing a button, say, for typing in a players name, use the "altcommand" attribute instead.
from what i saw in the 1.5 scripts, it looks like gui bitmap buttons use a suffix naming convention similar to skins. one filename represents the "off" or "normal" state which ends with a "_n". the other filename represents the "on" or "hovered-over" state and the filename ends with a "_h" suffix before the extension. theres also 2 files which represent alpha maps for each state. these have their own name suffixes as well. that's 4 images each button is using in total. I'm not sure if all those image files are necessary to get a bitmap button to work, but you could try something along those lines.