Issue descriptionI tried to add TWL gui to my project. I followed
this and changed my main app file. After that (application starts fine) I tried to append button to my app start screen, and what I saw: I can see a button. It changes colour from blue to green (I used theme from twl.zip-TWLExamples-src-test) when I move mouse on it. Everything seemed to be fine, but when I clicked on this button (It changed colour to red) it did not changed back.
When I create two buttons, after the first click on any of the buttons clicked button starts to be red and click or move on another button don't work.
Further information:While I trying to resolve this issue I used breakpoints in TWLInputAdapter and found that whan I click on button mouseReleased do not invoked. Otherwise when I click on the empty space near buttons, breakpoints show me that it works.
I create buttons in overrided
init method
Code:
@Override
public void init(GameContainer gc) throws SlickException {
// construct & configure root widget
root = new Widget();
root.setTheme("");
// save Slick's GL state while loading the theme
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
try {
lwjglRenderer = new LWJGLRenderer();
theme = ThemeManager.createThemeManager(
Client.class.getResource("guiTheme.xml"), lwjglRenderer);
gui = new GUI(root, lwjglRenderer);
gui.applyTheme(theme);
} catch (LWJGLException e) {
log.error(e);
} catch (IOException e) {
log.error(e);
} finally {
// restore Slick's GL state
GL11.glPopAttrib();
}
// connect input
twlInputAdapter = new TWLInputAdapter(gui, gc.getInput());
gc.getInput().addPrimaryListener(twlInputAdapter);
CmdArgs cmdArgs = CmdArgs.parseArgs(gc.getCmdLineArgs());
host = cmdArgs.getHost();
port = cmdArgs.getPort();
locale = cmdArgs.getLocale();
initialization(gc);
currentMenu = MenuManager.getAuthorizationMenu();
final Button b = new Button("test");
b.setPosition(200, 200);
b.setSize(100, 40);
final Button b2 = new Button("test2");
b2.setPosition(200, 250);
b2.setSize(100, 40);
root.add(b);
root.add(b2);
}
If you find there any mistakes, tell me about it, please, because english is not my native language.
