This commit is contained in:
58
app/src/main/java/gui/menu/MultiPlayerView.java
Normal file
58
app/src/main/java/gui/menu/MultiPlayerView.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package gui.menu;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import imgui.ImGui;
|
||||
import network.client.Client;
|
||||
import network.server.Server;
|
||||
|
||||
public class MultiPlayerView extends BaseView {
|
||||
|
||||
private Client client;
|
||||
private Server server;
|
||||
|
||||
/**
|
||||
* Client
|
||||
*
|
||||
* @param stateMachine
|
||||
* @param address
|
||||
* @param port
|
||||
* @throws IOException
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
public MultiPlayerView(StateMachine stateMachine, String address, short port)
|
||||
throws UnknownHostException, IOException {
|
||||
super(stateMachine);
|
||||
this.client = new Client(address, port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Server
|
||||
*
|
||||
* @param stateMachine
|
||||
* @param port
|
||||
* @throws IOException
|
||||
*/
|
||||
public MultiPlayerView(StateMachine stateMachine, short port) throws IOException {
|
||||
super(stateMachine);
|
||||
this.server = new Server(port);
|
||||
this.client = new Client("localhost", port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKill() {
|
||||
if (this.server != null) {
|
||||
this.server.stop();
|
||||
}
|
||||
if (this.client != null) {
|
||||
this.client.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
ImGui.text("Tema le gameplay");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user