We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › MyGUIStyle colours
Page Index Toggle Pages: 1
MyGUIStyle colours (Read 1303 times)
MyGUIStyle colours
Jul 23rd, 2006, 11:09pm
 
Hi,

I've been using the MyGUI library: http://www.mkv25.net/MyGUI/doc/

But I just don't get how I can set my own colours in MyGUIStyle. If I understand correctly, the instance variables like "background" and "highlight" should be set between 0 and 255 and would contain a brightness value. But where is the actual colour supposed to be defined and how?

Thanks very much

Jon
Re: MyGUIStyle colours
Reply #1 - Aug 2nd, 2006, 9:50am
 
Hi Jon,

To use colours in processing you need to use the color() method to generate an integer containing colour information.

Usually, you would type:
color red = color(255, 0, 0);

This is equivalent to saying:
int red = color(255, 0, 0);

Please read more about color method in the processing manual:
http://processing.org/reference/color_.html

So, to change the colours of a MyGUI object or group, you need to get the MyGUIStyle reference for a particular object, or assign a new instance of MyGUIStyle. Once you have a reference, you can then set individual colours or tint the overall shade.

For example- Tinting is the quickest way: Code:

...
// Initialise MyGUI objects
gui = new MyGUI(this);
button = new MyGUIButton(this, 30, 20, "Random", 40, 16);
slider = new MyGUIPinSlider(this, 140, 20, 160, 12, 1, 16);
checkbox = new MyGUICheckBox(this, 240, 20, "Pause");

// Add elements to main MyGUI group
gui.add(button);
gui.add(slider);
gui.add(checkbox);

// Set interface colour
gui.getStyle().tintColor(color(245, 128, 0)); // Sets a yellow tint
...
Taken from: http://mkv25.net/applets/guiRandomSquares/guiRandomSquares.pde

Also see this MyGUI Fonts example:
http://mkv25.net/applets/guiFonts/guiFonts.pde
- Creating and applying new style objects

Regards,
- Markavian
Page Index Toggle Pages: 1