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 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) {
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user