mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
add: own branch
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package org.toop;
|
||||
|
||||
import org.toop.core.*;
|
||||
import org.toop.eventbus.*;
|
||||
import org.toop.graphics.*;
|
||||
import org.toop.server.backend.ServerManager;
|
||||
import org.toop.server.frontend.ConnectionManager;
|
||||
|
||||
@@ -9,24 +12,63 @@ import org.apache.logging.log4j.LogManager;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class Main {
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
private static boolean running = false;
|
||||
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||||
registerEvents();
|
||||
|
||||
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();
|
||||
do {
|
||||
console.print();
|
||||
} while (console.next());
|
||||
|
||||
shader.start();
|
||||
renderer.render();
|
||||
}
|
||||
console.print();
|
||||
}
|
||||
|
||||
if (shader != null) shader.cleanup();
|
||||
if (renderer != null) renderer.cleanup();
|
||||
if (window != null) window.cleanup();
|
||||
}
|
||||
|
||||
private static void registerEvents() {
|
||||
GlobalEventBus.subscribeAndRegister(Events.WindowEvents.OnQuitRequested.class, event -> {
|
||||
quit();
|
||||
});
|
||||
|
||||
GlobalEventBus.subscribeAndRegister(Events.WindowEvents.OnMouseMove.class, event -> {
|
||||
});
|
||||
}
|
||||
public static void initSystems() {
|
||||
new ServerManager();
|
||||
new ConnectionManager();
|
||||
}
|
||||
|
||||
private static void quit() {
|
||||
running = false;
|
||||
}
|
||||
|
||||
public static boolean isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
public static void setRunning(boolean running) {
|
||||
Main.running = running;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user