Im very new to Multiplayer programming and i know the basics of kryonet. I made a little Top down shooter but when i try to do something that kryonet activates in the MainGame the game crashes and it gives me the error:“No opengl context in current thread”. I googled the problem and found out that it has something to do with Libgdx and kryo being on different Threads. I tried for an hour to figure out how to pass something from Kryonet to libgdx but everything doesnt work. My mainclass implements the runnable interface and has the method:
@Override
public void run() {
((Game) Gdx.app.getApplicationListener()).setScreen(MainGame.JPlayScreen);
}
and my Kryonet Customlistener has the method:
public void received(Connection c, Object o) {
if(o instanceof Packet0LoginRequest) {
Packet1LoginAnswer loginAnswer = new Packet1LoginAnswer();
loginAnswer.accepted = true;
c.sendTCP(loginAnswer);
GameHolder.game.run(); //Gameholder class holds the gameclass
}
}
But it still gives me the error:no opengl context found in current thread
I hope you can help me solve the problem
-Quexten