Page 1 of 1

Need little help with UIs... :P

PostPosted: Wed Jun 06, 12 7:02 pm
by atrey65789
I haven't ever messed with UI's.. could someone help find me a code for like a Template to start with? lol I would appreciate it.

PostPosted: Sun Jun 10, 12 10:26 am
by SimonDenton
Coding with GUI ain't easy and I pursue the same thing. I just browse MenuScreen and HUD classes in Wotgreal and notice the elements such as the one below:

Code: Select all
***************************************************
Toggle Checkbox
***************************************************
var MenuUICheckboxWindow         checkboxVariableReference;

// ----------------------------------------------------------------------
// CreateControls()
// ----------------------------------------------------------------------

function CreateControls()
{
   Super.CreateControls();

   CreateConfirmCheckbox();
}

// ----------------------------------------------------------------------
// CreateConfirmCheckbox()
// ----------------------------------------------------------------------

function CreateConfirmCheckbox()
{
   checkboxVariableReference = MenuUICheckboxWindow(winClient.NewChild(Class'MenuUICheckboxWindow')); //This is the actual GUI element

   checkboxVariableReference.SetPos(*x position*, *y position*); //Positioning
   checkboxVariableReference.SetText(*Text to display regarding this checkbox*);
   checkboxVariableReference.SetFont(Font'*Name of font*');
   checkboxVariableReference.SetToggle(*bool we are toggling*);
}

// ----------------------------------------------------------------------
// ToggleChanged()
// ----------------------------------------------------------------------

event bool ToggleChanged(Window button, bool bNewToggle)
{   
   if (button == checkboxVariableReference)
   {
      *bool we are toggling* = bNewToggle;
      return True;
   }
   else
   {
      return False;
   }
}

PostPosted: Sun Jun 10, 12 12:08 pm
by Dae
+ There's a lot you could pick up from Project 2027.

PostPosted: Sun Jun 10, 12 12:56 pm
by atrey65789
Thank you both... Simon, I'll be sure to keep that in mind.

Dae, That's a good idea, I'll do that.