mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
Merge branch 'Ticho' of github.com:2OOP/pism_ttt into Ticho
# Conflicts: # src/main/java/org/toop/Main.java # src/main/java/org/toop/eventbus/Events.java # src/main/java/org/toop/game/TTT.java # src/main/resources/log4j2.xml
This commit is contained in:
@@ -1,53 +1,45 @@
|
||||
package org.toop;
|
||||
|
||||
import org.toop.UI.GameSelectorWindow;
|
||||
import org.toop.eventbus.*;
|
||||
import org.toop.eventbus.Events;
|
||||
import org.toop.eventbus.GlobalEventBus;
|
||||
import org.toop.server.backend.ServerManager;
|
||||
import org.toop.server.frontend.ConnectionManager;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.toop.server.frontend.ConnectionManager;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class Main {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
private static boolean running = false;
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
private static boolean running = false;
|
||||
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||||
initSystems();
|
||||
registerEvents();
|
||||
initSystems();
|
||||
registerEvents();
|
||||
/*
|
||||
Window window = Window.setup(Window.API.GLFW, "Test", new Window.Size(1280, 720));
|
||||
Renderer renderer = Renderer.setup(Renderer.API.OPENGL);
|
||||
|
||||
// Window window = Window.setup(Window.API.GLFW, "Test", new Window.Size(1280, 720));
|
||||
// Renderer renderer = Renderer.setup(Renderer.API.OPENGL);
|
||||
// initSystems();
|
||||
// Logging.disableLogs();
|
||||
//
|
||||
// Shader shader = Shader.create(
|
||||
// "src/main/resources/shaders/gui_vertex.glsl",
|
||||
// "src/main/resources/shaders/gui_fragment.glsl");
|
||||
//
|
||||
// running = window != null && renderer != null && shader != null;
|
||||
// ConsoleGui console = new ConsoleGui();
|
||||
//
|
||||
// while (running) {
|
||||
// window.update();
|
||||
// renderer.clear();
|
||||
//
|
||||
// shader.start();
|
||||
// renderer.render();
|
||||
// }
|
||||
// console.print();
|
||||
//
|
||||
// if (shader != null) shader.cleanup();
|
||||
// if (renderer != null) renderer.cleanup();
|
||||
// if (window != null) window.cleanup();
|
||||
if (!initEvents()) {
|
||||
throw new RuntimeException("A event could not be initialized");
|
||||
}
|
||||
|
||||
TcpServer server = new TcpServer(5001);
|
||||
Thread serverThread = new Thread(server);
|
||||
serverThread.start();
|
||||
Server.start("127.0.0.1", "5001");
|
||||
// Testsss.start(""); // Used for testing server.
|
||||
Window.start("");
|
||||
*/
|
||||
|
||||
// JFrameWindow window = new JFrameWindow();
|
||||
GameSelectorWindow gameSelectorWindow = new GameSelectorWindow();
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns false if any event could not be initialized.
|
||||
*/
|
||||
|
||||
private static void registerEvents() {
|
||||
GlobalEventBus.subscribeAndRegister(Events.WindowEvents.OnQuitRequested.class, event -> {
|
||||
@@ -57,6 +49,7 @@ public class Main {
|
||||
GlobalEventBus.subscribeAndRegister(Events.WindowEvents.OnMouseMove.class, event -> {
|
||||
});
|
||||
}
|
||||
|
||||
public static void initSystems() {
|
||||
new ServerManager();
|
||||
new ConnectionManager();
|
||||
@@ -74,4 +67,3 @@ public class Main {
|
||||
Main.running = running;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package org.toop.eventbus;
|
||||
|
||||
import org.toop.core.Window;
|
||||
import org.toop.server.backend.tictactoe.TicTacToeServer;
|
||||
import org.toop.server.backend.tictactoe.TicTacToeServerCommand;
|
||||
import org.toop.core.*;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Arrays;
|
||||
@@ -203,7 +202,7 @@ public class Events implements IEvents {
|
||||
* @param args The command arguments.
|
||||
* @param result The result returned from executing the command.
|
||||
*/
|
||||
public record OnCommand(TicTacToeServer command, String[] args, String result) {}
|
||||
public record OnCommand(TicTacToeServer command, String[] args, String result) {} // TODO old
|
||||
|
||||
/**
|
||||
* Triggers when the server client receives a message.
|
||||
@@ -261,6 +260,9 @@ public class Events implements IEvents {
|
||||
* Triggers when a cell is clicked in one of the game boards.
|
||||
*/
|
||||
public record CellClicked(int cell) {}
|
||||
}
|
||||
|
||||
public static class EventBusEvents {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user