Game Development Community

Profiles

by baylor wetzel · in Torque Game Builder · 07/06/2006 (10:49 am) · 5 replies

Sorry for all the questions. i'm a trial user and am trying to learn what i can in the time allotted

As far as i can tell, you cannot set borders, color, font size, bold, text alignment, etc. in the GUI builder. Instead, you specify the control's profile (GuiTextCtrl, GuiButtonCtrl, etc.) and it sets all that for you. i'm not sure where these profiles live. i was hoping there was a directory where i would find them and where i could drop in my own

Is there a way to create one's own profile? i'm sure there must be. How would one do this?

#1
07/07/2006 (1:15 pm)
Yes you can create your own profiles. Here is an example of a GuiControlProfile that sets a type of font:

new GuiControlProfile (GuiMenuButtonProfile)
{
   opaque = true;
   border = true;
   fontColor = "7 9 169";
   fontColorHL = "100 100 100";
   fillColor = "232 232 232 0";
   fixedExtent = true;
   justify = "center";
   canKeyFocus = false;

   // font
   fontType = "Libel Suit";
   fontSize = 25;
   fontCharset = CHINESEBIG5;
};

If you're curious what all the fields are, here's a list dump()'ed from a default GuiControlProfile:
autoSizeHeight = "0"
  autoSizeWidth = "0"
  bevelColorHL = "0 0 0 0"
  bevelColorLL = "0 0 0 0"
  bitmap = "common/gui/images/window"
  border = "1"
  borderColor = "40 40 40 100"
  borderColorHL = "128 128 128 255"
  borderColorNA = "64 64 64 255"
  borderThickness = "1"
  canKeyFocus = "0"
  canSaveDynamicFields = "1"
  cursorColor = "0 0 0 255"
  fillColor = "211 211 211 255"
  fillColorHL = "244 244 244 255"
  fillColorNA = "244 244 244 255"
  fontCharset = "ANSI"
  fontColor = "0 0 0 255"
  fontColorHL = "32 100 100 255"
  fontColorLink = "0 0 0 0"
  fontColorLinkHL = "0 0 0 0"
  fontColorNA = "0 0 0 255"
  fontColors[0] = "0 0 0 255"
  fontColors[1] = "32 100 100 255"
  fontColors[2] = "0 0 0 255"
  fontColors[3] = "200 200 200 255"
  fontColors[4] = "0 0 0 0"
  fontColors[5] = "0 0 0 0"
  fontColors[6] = "0 0 0 0"
  fontColors[7] = "0 0 0 0"
  fontColors[8] = "0 0 0 0"
  fontColors[9] = "0 0 0 0"
  fontColorSEL = "200 200 200 255"
  fontSize = "14"
  fontType = "Arial"
  justify = "left"
  Modal = "1"
  mouseOverSelected = "0"
  numbersOnly = "0"
  opaque = "0"
  profileForChildren = ""
  returnTab = "0"
  soundButtonDown = ""
  soundButtonOver = ""
  tab = "0"
  textOffset = "0 0"

Hope this helps.

Edit: I almost forgot, you're gonna want to exec your profile definitions from your main.cs so you have them in the editor without running your project.
#2
07/07/2006 (2:00 pm)
TGB/games/common/gui/profiles.cs
#3
07/07/2006 (2:03 pm)
For me to use this, where would i put this? Do i create a file named, um, MyProfile.profile and put it in some directory somewhere? Do i just create it like normal code in gamescripts/MyProfile.cs?
#4
07/07/2006 (2:05 pm)
Ah, i asked about the directory just before Midhir pointed it out. i see how it's done now. And i can see what all those pre-existing profiles do so i can figure out which ones to use! Thanks
#5
07/07/2006 (3:58 pm)
So as not to mess with common, I would suggest you put your profile script file in the gui folder for your project and then exec it from the main.cs in that project folder.