Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 3:25 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jul 25, 2012 6:07 pm 
Offline

Joined: Wed Jul 25, 2012 5:49 pm
Posts: 5
Hi,

I spend the whole day trying to get TWL to work with Slick, but it seems to behave different then documented:
i have 3 gamestates: MainMenuState, NetworkState and inGameState. To join a game you have to go throw all of them in sequence, starting with the MainMenuState and ending with inGameState.
As part of my immigration to TWL, i downloaded the provided .zip and made all of my classes into 'BasicLWTGameState'.
I have the same code in all of these classes, but it only seems to trigger(the output only displays once) in the NetworkState one (there i can see the button).
The code in all of the Classes:
Code:
    private Button btn;
    @Override
    protected RootPane createRootPane() {
        RootPane rp = super.createRootPane();
        System.out.println("set theme... " + rp.getTheme());
        rp.setTheme("myTheme");
        btn = new Button("connect");
        btn.setTheme("myButton");
        btn.addCallback(new Runnable() {
            public void run() {
               System.out.println("it works?!");
            }
        });
        rp.add(btn);
        return rp;
    }
   
    @Override
    protected void layoutRootPane() {
        btn.adjustSize();
        btn.setPosition(100, 100);
    }


TL;DR: I can see a Button in the second of 3 States but not in the first or third one + the createRootPane does seems to only be called once instead once for every State.

I hope someone can help me.
Thanks in advance!

-ara


Top
 Profile  
 
PostPosted: Wed Jul 25, 2012 9:15 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Umm - paste more code - or attach it as zip.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Thu Jul 26, 2012 11:40 am 
Offline

Joined: Wed Jul 25, 2012 5:49 pm
Posts: 5
aaaah! I got it to work: It was because i overrode the enter Method, without calling super.enter.
Is the Wiki editable for Users? I would like to add some notes to the "Integrating TWL into StateBasedGame" article :mrgreen:


Top
 Profile  
 
PostPosted: Thu Jul 26, 2012 6:36 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Make an account on the wiki and send me the name via PM

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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