summaryrefslogtreecommitdiffstats
path: root/src/subconscious/graphics/GameWindow.java
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-12-12 02:55:28 +0100
committerNao Pross <naopross@thearcway.org>2018-12-12 02:56:44 +0100
commit96377f0c1b9a3e97de767d0ef413fea0a2847a87 (patch)
treecff4eb64a5bac3136963b8a1f3e43325692d361c /src/subconscious/graphics/GameWindow.java
parentAdd initial impl for sprites (diff)
downloadSubconscious-java-96377f0c1b9a3e97de767d0ef413fea0a2847a87.tar.gz
Subconscious-java-96377f0c1b9a3e97de767d0ef413fea0a2847a87.zip
Separate UPS from FPS, make thread for GameWindow (graphics thread)
The separation of game logic updates from render updates is necessary to proceed on the implementation of sprites. Otherwise the speed of animations of menus and sprites would depend on the game update speed. This commit breaks PerfView.
Diffstat (limited to 'src/subconscious/graphics/GameWindow.java')
-rw-r--r--src/subconscious/graphics/GameWindow.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/subconscious/graphics/GameWindow.java b/src/subconscious/graphics/GameWindow.java
index 12de165..66fe26e 100644
--- a/src/subconscious/graphics/GameWindow.java
+++ b/src/subconscious/graphics/GameWindow.java
@@ -19,7 +19,7 @@ import java.awt.event.WindowEvent;
* unloading scenes, and the window itself
*/
@SuppressWarnings("serial")
-public class GameWindow extends Frame implements WindowListener {
+public class GameWindow extends Frame implements Runnable, WindowListener {
public static final Dimension WINDOW_SIZE = new Dimension(1280, 720);
private Panel root;
@@ -51,13 +51,10 @@ public class GameWindow extends Frame implements WindowListener {
this.add(this.root, BorderLayout.CENTER);
this.pack();
this.setVisible(true);
-
- // start Window Loop
- this.loop();
}
- // ovserver of this.game
- private void loop() {
+ @Override
+ public void run() {
// load the first scene
this.loadScene(new MainMenuScene(this.game));