Load all project

This commit is contained in:
2026-10-07 13:34:50 +00:00
parent 40c6ad2af0
commit bb2d288bfd
10 changed files with 540 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
public class GameLoop implements Runnable {
private final GamePanel panel;
private volatile boolean running;
public GameLoop(GamePanel panel) {
this.panel = panel;
this.running = false;
}
public void start() {
running = true;
Thread thread = new Thread(this);
thread.start();
}
@Override
public void run() {
long sleepTime = 1000 / GameConfig.FPS;
while (running) {
panel.updateGame();
panel.repaint();
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
}
}