Slick Forums

Discuss the Slick 2D Library
It is currently Mon May 20, 2013 1:10 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Jan 02, 2012 9:10 pm 
Offline

Joined: Sun Dec 25, 2011 4:51 pm
Posts: 22
Hello,

Is it possible to create custom color aliases to use them like color="*****"?

Thanks in advance.


Top
 Profile  
 
PostPosted: Tue Jan 03, 2012 12:22 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Sure, you can declare custom colors as constants:
Code:
<constantDef name="my_color"><color>#123456</color></constantDef>

Then you can use my_color in every place which accepts a numeric color or predefined color name.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Tue Jan 03, 2012 10:09 am 
Offline

Joined: Sun Dec 25, 2011 4:51 pm
Posts: 22
Matthias, thank you ! I like your library more and more.


Top
 Profile  
 
PostPosted: Tue Jan 03, 2012 10:34 am 
Offline

Joined: Sun Dec 25, 2011 4:51 pm
Posts: 22
i''ve tried this method but possibly did something wrong

in my theme file i have

<constantDef name="font_light_grey"><color>#9eb8bf</color></constantDef>

and

<fontDef name="helvetica_lt_lg" filename="HelveticaNeueLTStd-Lt.fnt" color="font_light_grey"/>

and got an exception

Time: 14:29:16
Category: theme loading
Title: Exception while loading theme

java.io.IOException: while parsing Theme XML: testenv://local:80/D:/Work/Dev/water-co ... s/main.xml
at de.matthiasmann.twl.theme.ThemeManager.parseThemeFile(ThemeManager.java:272)
at de.matthiasmann.twl.theme.ThemeManager.createThemeManager(ThemeManager.java:186)
at de.matthiasmann.twlthemeeditor.gui.PreviewWidget.loadTheme(PreviewWidget.java:350)
at de.matthiasmann.twlthemeeditor.gui.PreviewWidget.executeTestEnv(PreviewWidget.java:269)
at de.matthiasmann.twlthemeeditor.gui.PreviewWidget.paintWidget(PreviewWidget.java:224)
at de.matthiasmann.twl.Widget.paint(Widget.java:2020)
at de.matthiasmann.twl.Widget.drawWidgetClip(Widget.java:2535)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2508)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.Widget.paintChildren(Widget.java:2073)
at de.matthiasmann.twl.Widget.paint(Widget.java:2021)
at de.matthiasmann.twl.Widget.drawWidget(Widget.java:2511)
at de.matthiasmann.twl.GUI.draw(GUI.java:644)
at de.matthiasmann.twl.GUI.update(GUI.java:564)
at de.matthiasmann.twlthemeeditor.Main.run(Main.java:246)
at de.matthiasmann.twlthemeeditor.Main.main(Main.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: unknown color name: font_light_grey
at de.matthiasmann.twl.renderer.lwjgl.LWJGLFont.createFontState(LWJGLFont.java:86)
at de.matthiasmann.twl.renderer.lwjgl.LWJGLFont.<init>(LWJGLFont.java:74)
at de.matthiasmann.twl.renderer.lwjgl.LWJGLRenderer.loadFont(LWJGLRenderer.java:365)
at de.matthiasmann.twl.theme.ThemeManager.parseFont(ThemeManager.java:382)
at de.matthiasmann.twl.theme.ThemeManager.parseThemeFile(ThemeManager.java:306)
at de.matthiasmann.twl.theme.ThemeManager.parseThemeFile(ThemeManager.java:267)
... 41 more


Top
 Profile  
 
PostPosted: Tue Jan 03, 2012 5:31 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Sadly you have found a place where these custom color can't yet be used. I'm currently working on an update to the font rendering engine. With that update you will be able to use your custom colors also for fonts, but there is no scheduled release date for that yet.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Tue Jan 03, 2012 6:31 pm 
Offline

Joined: Sun Dec 25, 2011 4:51 pm
Posts: 22
Thanks for the clarification. I will create workaround and wait for an update.


Top
 Profile  
 
PostPosted: Thu Jan 05, 2012 7:31 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Can you try again? - the new version should now be able to handle that.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Thu Jan 05, 2012 8:23 pm 
Offline

Joined: Sun Dec 25, 2011 4:51 pm
Posts: 22
Matthias, now it is working! Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group