Font Color Change

Jan 12, 2012 at 12:47 AM

kk...So I've been going through the source and what not...

I cannot find a way to change font color w/o implementing an entirely new skin...WHICH I DEFINITELY DO NOT WANT TO DO.

So is there a way to change the font color on a given control w/o a new skin file?

 

Cheers

Jan 12, 2012 at 1:04 AM

Well I ended up doing this anyway.

For those who wish to know the following code is provided.

 

In my Game.Initialize()

gui.Visualizer = FlatGuiVisualizer.FromFile(Content.ServiceProvider, "Content\\xml\\Suave.skin.xml");

*note* The files {TitleFont, DefaultFont, Sauve.png} must be in the same directory...in the case about a sub folder in the content project called XML.

The following 2 links are where you can find those files.

 

For {TitleFont, DefaultFont, Sauve.png}

https://devel.nuclex.org/framework/svn/ui/Nuclex.UserInterface/trunk/EmbeddedContent/Skins/Suave/

For Sauve.skin.xml

https://devel.nuclex.org/framework/svn/ui/Nuclex.UserInterface/trunk/Resources/Skins/Suave/Suave.skin.xml

 

*Cautionary Note*

When I used the Sauve.skin.xml from the SVN, None of the objects rendered correctly. There is a Y Offset on several items. If you remove the offset the objects then render correctly. I set all Y Offsets to 0.

 

I hope this helps some people out :)

Jan 14, 2012 at 4:32 AM

What I would really like to have it something like HTML text coloring. Where I can color specific words within a string. With XNA sprite fonts this means new draw calls for each color, not sure how, or if, it would work with the Nuclex font stuff and the GUI.

Jan 14, 2012 at 5:25 AM

well i think each control should have colour fields, however the current way they are rendered is from a texture so essentially they are all images.