network structure
Some checks failed
Linux arm64 / Build (push) Failing after 5m1s

This commit is contained in:
2025-01-23 18:59:11 +01:00
parent b05351bc20
commit 5e99cd92df
21 changed files with 429 additions and 36 deletions

View 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");
}
}