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:
@@ -21,7 +21,7 @@ public class MainGame extends ApplicationAdapter {
|
||||
float screenWidth;
|
||||
float screenHeight;
|
||||
private FrameRate frameRate;
|
||||
private Client client;
|
||||
private Thread client;
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
@@ -39,12 +39,12 @@ public class MainGame extends ApplicationAdapter {
|
||||
music.setVolume(.1f);
|
||||
music.play();
|
||||
music.setLooping(true);
|
||||
|
||||
connectToServer();
|
||||
}
|
||||
|
||||
|
||||
private void connectToServer() {
|
||||
client = new Client("localhost", Server.PORT);
|
||||
client = new Thread(new Client("localhost", Server.PORT));
|
||||
try {
|
||||
client.start();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -14,10 +14,7 @@ public class Client extends Controller {
|
||||
private String hostname;
|
||||
private boolean isConnected = true;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.connect();
|
||||
}
|
||||
|
||||
|
||||
public Client(String hostname, int port) {
|
||||
this.port = port;
|
||||
@@ -74,4 +71,9 @@ public class Client extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.connect();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user