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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user