Game Development Community

Help GUI plz...

by Wendell Smith · in Torque Game Engine · 09/01/2002 (12:37 pm) · 0 replies

ok... I have created a GUI to allow a player to select what seat he wants to occupy in certain verhicles...

This gui will be brought up only while in the game. It's much like T2's inventory hud screen. I just need a little box to pop up with some items that will allow the player to set certain client side vars.

For now, my GUI has only three pieces I am concerned with. A Window Control(not certain why I chose this), a save Button, and a Pop-Up menu.


new GuiControl(SeatHUD) {
   profile = "GuiModelessDialogProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 8";
   visible = "1";
   helpTag = "0";

   new GuiWindowCtrl(SH_WindowCtrll) {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "0 190";
      extent = "210 275";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      text = "STG Seat Pref HUD";
      maxLength = "255";
      resizeWidth = "0";
      resizeHeight = "0";
      canMove = "1";
      canClose = "0";
      canMinimize = "0";
      canMaximize = "0";
      minSize = "50 50";

      new GuiButtonCtrl(SH_SaveBtn) {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "69 243";
         extent = "71 23";
         minExtent = "8 8";
         visible = "1";
         command = "SeatHUD.CloseHud();";
         helpTag = "0";
         text = "Save";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiTextCtrl(SH_JeepLabel) {
         profile = "GuiTextProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "21 38";
         extent = "26 18";
         minExtent = "8 8";
         visible = "1";
         helpTag = "0";
         text = "Jeep:";
         maxLength = "255";
      };
      new GuiPopUpMenuCtrl(SH_JeepMenu) {
         profile = "GuiPopUpMenuProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "64 38";
         extent = "122 21";
         minExtent = "8 8";
         visible = "1";
         helpTag = "0";
         maxLength = "255";
         maxPopupHeight = "200";
      };
   };
};

My first problem is this...

When I use the Pop-Up menu, the damn thing maximizes or sometimes even minimizes. No idea here... Know why or how to stop this?

My second problem is this...

I set up the Pop-Up hud like such:

// number of seat vars
$NumJeepSeats = 3;

// jeep seat name vars for
$JeepSeat[0] = "Driver";
$JeepSeat[1] = "Shotgun";
$JeepSeat[2] = "Gunner";

function SeatHUD::SetUpHud( %this, %tag )
{
	// set up the jeep menu
	for(%i = 0; %i < $NumJeepSeats; %i++)
		SH_JeepMenu.add($JeepSeat[%i], %i);
}

I then set what is displayed to user like so:

function SeatHUD::onWake()
{
	
	SH_JeepMenu.setSelected($pref::Player::jeepSeat);	
}

How do I get at that second variable stored in SH_JeepMenu?

Doing this:

SH_JeepMenu.getValue();

Only gives me the string var. My life would be a lot easier if I could just access that int(the second var in SH_JeepMenu). Know how?

Thx as always!