PopUpMenuProfile GUI
by Jamal Moon · in Technical Issues · 06/09/2008 (6:52 pm) · 2 replies
I have been working on adding more game options but there is one part I cant get to work!!! For the game types, I want to make a PopUpMenu GUI so that the following names would show up: CTF (capture the flag), KOTH (king of the hill), and Campaign. I looked at other samples from the original options but I still cant figure how they did it. I could use a check box, but if the player selects more than one game type, it can cause some problems. Is there another GUI I should use? If not, how do I use the PopUp GUI?
About the author
Torque Owner Gary Preston
new GuiPopUpMenuCtrl(GameModeCombo) { canSaveDynamicFields = "1"; Profile = "GuiPopUpMenuProfile"; HorizSizing = "right"; VertSizing = "bottom"; position = "350 100"; Extent = "230 22"; MinExtent = "8 2"; Visible = "1"; maxLength = "255"; maxPopupHeight = "200"; };Somewhere, before the code, define the available modes
Then in onWake for the gui it's a part (lets assume it's called LevelSelectGUI) of do
function LevelSelectGUI::onWake(%this) { gameModeCombo.clear(); for (%i=0; %i < $Game::GameModesCount; %i++) { GameModeCombo.add( $Game::GameModes[%i], %i ); } // You may want to store the last played game mode ID in a pref and set it here rather // than always defaulting back to 0 GameModeCombo.setSelected( 0 ); } function GameModeCombo::onSelect( %this, %id, %text ) { %modeName = $Game::GameModes[%id] echo("Player has selected the game mode -" SPC %modeName ); }