Game Development Community

Gui Font Color

by Matt Sanders · in Torque Game Engine · 01/13/2005 (7:57 pm) · 5 replies

I looked in the forums but could not find any information about what I am trying to do. Is there a way to change the font color and format within each gui control. I am trying to change the color of the text on the menu screen only but keep it the same for things like the chat hud. Thanks in advance.

#1
01/13/2005 (9:16 pm)
I suggest brushing up on your searching techniques if you couldn't find anything.

A 10 second search on the word "color" produced the resource Your own GUI Color Codes and browsing this very page I can see another thread entitled Coloring text in gui's (I have 50 threads per page, not sure what your setting is)

Nevertheless, I thought I'd have a quick play seeing I'd gone this far to make sure I had it right in my own mind (plus I'm on holiday!! yay)

www.bobizam.hostinghelp.co.nz/images/gg/gui-colour-test.jpg
1) Opened up the gui editor and added some text Its black and i can barely read it.

2) Opened common/ui/defaultProfiles.cs and changed as follows.

if(!isObject(GuiTextProfile)) new GuiControlProfile (GuiTextProfile)
{

   // changed VERNON FINCH 14/01/05
   fontColors[1] = "250 90 90";
   fontColors[2] = "250 250 200";
   //fontColor = "0 0 0";
   fontColorLink = "255 96 96";
   fontColorLinkHL = "0 0 255";
   autoSizeWidth = true;
   autoSizeHeight = true;
};

3) Opened mainMenu.gui and changed the text from this

text = "Hello World, this is a test, I\'m trying to provide a solution for Matt Sanders";

to this:

text = "\c1Hello World, \c2this is a test, I\'m trying to provide a solution for Matt Sanders";


Hope thats clear, and I hope it all displays :)
#2
01/14/2005 (1:32 pm)
Sorry, I totally forgot to check the resources. lately when I have been searching for info the only place I find what I need is in the forums.

great answer by the way. :)
#3
06/15/2006 (10:10 pm)
Does this still work? I have followed these directions exactly at least 10 times and can't seem to get it to work.

if(!isObject(GuiTextProfile)) new GuiControlProfile (GuiTextProfile)
{
   //fontColor = "0 0 0";
   fontColor[1] = "0 0 0"; //Black
   fontColor[2] = "100 0 0"; //Green
   fontColor[3] = "0 100 0"; //Red
   fontColor[4] = "0 0 100"; //Blue
   fontColor[5] = "100 100 100";//grey
   fontColor[6] = "255 255 255";//white
   fontColorLink = "255 96 96";
   fontColorLinkHL = "0 0 255";
   autoSizeWidth = true;
   autoSizeHeight = true;
};

And here is the other part.

new GuiTextCtrl(test) {
      Profile = "GuiTextProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "182 178";
      Extent = "189 18";
      MinExtent = "8 2";
      Visible = "1";
      text = "\c1This \c2is a \c3test \c4in color \c5mani\c6pulation.";
      maxLength = "255";
   };

The colors are white, darker white, darker white, darker white, light purple, lighter purple..

Do I need to do something in customProfiles.cs, or does this code just not work with 1.4 very well?
#4
06/16/2006 (12:34 am)
I think something might be broken with colours in 1.4 . Some of my code that used them in 1.3 didn't work in 1.4...
#5
06/17/2006 (2:07 am)
The array should be named "fontColors" not "fontColor"

Also be careful setting values [0-3] if you still plan to define "fontColor, fontColorHL, fontColorNA, fontColorSel" as these are mapped to values [0-3]. FontColors[4-9] are available for user defined colours.