Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 7:33 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jun 13, 2012 2:29 pm 
Offline

Joined: Sun Jun 03, 2012 1:47 pm
Posts: 5
Hi,

I downloaded TWL and in the examples folder it has a bunch of xml themes, e.g. simple.xml, login.xml, gameuidemo.xml etc.

For now, my game has a login state and a gameplay state (both of type BasicTWLGameState). I wanted the rootpane for loginState to use the login.xml theme, and the gameplayState to use simple.xml theme.

However, currently the way I see it the theme is loaded in my TWLstateBasedGame class (in initGUI() which calls loadTheme(renderer), using getThemeURL), and not by each individual state. Therefore I can only use one theme throughout the game. I thought about how I could get around the problem but as a complete beginner the only way I could do it would be to make one massive xml theme with everything included (i.e. login and simple combined). Alternatively I could start playing around with the RootPane and BasicTWLGameState classes but I don't want to screw everything up.

Can anyone suggest a good way of switching between different themes for each rootpane?

Thanks,


Top
 Profile  
 
PostPosted: Wed Jun 13, 2012 10:11 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
You make one big XML - or you use <include> to combine them.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Wed Jun 13, 2012 11:17 pm 
Offline

Joined: Sun Jun 03, 2012 1:47 pm
Posts: 5
MatthiasM wrote:
You make one big XML - or you use <include> to combine them.


thanks! I've sorted out the problem now.

I also have one more question. When Slick changes between states, everything is still in memory so when I reenter the login state I still have the user's inputted text in the editFields and the log (a text area) still shows all the text from the previous login attempt.

I'm writing a reset method for the login state, so ideally I want to clear all the text in the message log and also the edit fields. However I have no idea how I can clear everything, for text area the only method I can seem to find is appendRow which just adds text.

Any help would be greatly appreciated!


Top
 Profile  
 
PostPosted: Thu Jun 14, 2012 5:27 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
TextArea has no appendRow method - that is in the ChatDemo.
And as the name suggests it's only a demo - so if you need additional features you have to add them (loook at ChatDemo.java line 219).

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Thu Jun 14, 2012 12:34 pm 
Offline

Joined: Sun Jun 03, 2012 1:47 pm
Posts: 5
MatthiasM wrote:
TextArea has no appendRow method - that is in the ChatDemo.
And as the name suggests it's only a demo - so if you need additional features you have to add them (loook at ChatDemo.java line 219).


Oh I see. I've created some additional methods now such as clearText() which just uses the stringbuilder and removes all the strings inside, and everything works.

Also 2 of my gamestates have identical backgrounds but different widgets, so when I transition from one to another there's a flicker on the screen. The two states have different rootpanes so I guess everything has to be rerendered. Is there any way I can avoid this?

EDIT: I found a solution, I have the background as part of slick instead of being loaded in the xml file


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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