If I change the screen like this it works.
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
someclass.setScreen(someclass.getGameScreen());
}
});
But my goal is to use a server response to change the screen like this:
Main.java
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
client.sendTCP(new ChangeLobbyToGameRequest());
}
});
and
public void changeToGame(){
someclass.setScreen(someclass.getGameScreen());
}
Server listener
if (object instanceof ChangeLobbyToGameResponse){
Main.changeToGame();
}
but then I get the following error
E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.somegame.game, PID: 15828
java.lang.IllegalArgumentException: Error compiling shader:
at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:164)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:127)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:81)
at com.labyrix.game.Screens.GameScreen.show(GameScreen.java:46)
at com.badlogic.gdx.Game.setScreen(Game.java:61)
at com.labyrix.game.Screens.Lobbyscreen.changeToGame(LobbyScreen.java:59)
Gamescreen show method
@Override
public void show() {
batch = new SpriteBatch();
isorend = new Board(batch);
.....
}