안녕하십니까! Slick2d에서 Nifty Gui를 사용하려고합니다. Nifty Gui의 입력 폴링 외에 모든 것이 올바르게 작동합니다. 그것은 전혀 반응하지 않습니다! 여기에 내 코드의 일부입니다Nifty Gui가 입력에 반응하지 않습니다
XML을 :
<nifty xmlns="http://nifty-gui.lessvoid.com/nifty-gui">
<screen id="GamePlay" controller="GamePlayScreenController">
<layer childLayout="vertical">
<panel id="roomListPanel" width="100%" height="32px"
childLayout="absolute-inside" padding="5px">
<control id="appendButton" name="button" label="Pause">
<interact onClick="test()" />
</control>
</panel>
</layer>
</screen>
</nifty>
자바 :
class GamePlayScreenController implements ScreenController {
public void bind(Nifty nifty, Screen screen) {
System.out.println("Bind");
}
public void onEndScreen() {
System.out.println("End");
}
public void onStartScreen() {
System.out.println("Start");
}
public void test() {
System.out.println("Test");
}
}
...
// In my state class:
this.nifty = new Nifty(new LwjglRenderDevice(), new NullSoundDevice(), new LwjglInputSystem(), new TimeProvider());
this.nifty.loadStyleFile("nifty-default-styles.xml");
this.nifty.loadControlFile("nifty-default-controls.xml");
this.nifty.registerScreenController(new GamePlayScreenController());
this.nifty.fromXml("data/test.xml", "GamePlay");
this.nifty.gotoScreen("GamePlay");
...
this.nifty.update();
...
SlickCallable.enterSafeBlock();
this.nifty.render(false);
SlickCallable.leaveSafeBlock();
그렇지 않은 이유는, 아무 생각이 없습니다. 도와주세요! 감사!
감사합니다. 그러나 해결책이 작동하지 않았습니다. 그래, 나는 Nifty + Slick 2d 주를 시도했지만 그들은 나를 도와주지 않았다. 답변 해줘서 고마워! –