Fixed issue with build.

Changed MainGame to create a thread instead of a client and used the client as input for the thread
Changed client to extend Controller instead of thread
This commit is contained in:
MickWerf
2020-05-15 21:45:57 +02:00
parent 63f24b1bb1
commit 7969746bc1
2 changed files with 9 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ public class MainGame extends ApplicationAdapter {
float screenWidth; float screenWidth;
float screenHeight; float screenHeight;
private FrameRate frameRate; private FrameRate frameRate;
private Client client; private Thread client;
@Override @Override
public void create() { public void create() {
@@ -39,12 +39,12 @@ public class MainGame extends ApplicationAdapter {
music.setVolume(.1f); music.setVolume(.1f);
music.play(); music.play();
music.setLooping(true); music.setLooping(true);
connectToServer(); connectToServer();
} }
private void connectToServer() { private void connectToServer() {
client = new Client("localhost", Server.PORT); client = new Thread(new Client("localhost", Server.PORT));
try { try {
client.start(); client.start();
} catch (Exception e) { } catch (Exception e) {

View File

@@ -14,10 +14,7 @@ public class Client extends Controller {
private String hostname; private String hostname;
private boolean isConnected = true; private boolean isConnected = true;
@Override
public void run() {
this.connect();
}
public Client(String hostname, int port) { public Client(String hostname, int port) {
this.port = port; this.port = port;
@@ -74,4 +71,9 @@ public class Client extends Controller {
} }
} }
} }
@Override
public void run() {
this.connect();
}
} }