Files
Jander_Semester2/Semesterprojekt/src/main/java/thb/jeanluc/adventure/AppGui.java
Jean-Luc Makiola 83643a192f semesterprojekt: implement full text adventure (phases 1-7)
Walking skeleton through Swing GUI: YAML-driven world (4 rooms,
4 items, 1 NPC), HashMap command dispatch with parser, three-tier
item hierarchy (readable / switchable / plain), and end-to-end
NPC give/receive flow. 67 tests green.
2026-05-25 21:37:59 +02:00

41 lines
1.1 KiB
Java

package thb.jeanluc.adventure;
import lombok.extern.slf4j.Slf4j;
import thb.jeanluc.adventure.io.SwingIO;
import javax.swing.SwingUtilities;
/**
* Entry point for the Swing version of the game. The Swing window is
* built on the Event Dispatch Thread; the game loop itself runs in a
* background worker so that EDT events (typing) and blocking
* {@code readLine()} calls never deadlock each other.
*/
@Slf4j
public final class AppGui {
private AppGui() {
}
/**
* Standard JVM entry point.
*
* @param args ignored
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
SwingIO io = new SwingIO("Haunted Manor");
Thread worker = new Thread(() -> {
try {
App.run(io);
} catch (RuntimeException e) {
log.error("Fatal error during game startup", e);
io.write("Fatal error: " + e.getMessage());
}
}, "game-loop");
worker.setDaemon(true);
worker.start();
});
}
}