summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-11-20 20:39:18 +0100
committerNao Pross <naopross@thearcway.org>2018-11-20 20:39:18 +0100
commitf35878cbe3e5e7e04e43561fcb0b218cc83e761f (patch)
tree85f8174cebda55c3cea6b00014020a443dfe2eb4
parentRemove Scene.absoluteRender(), add Scene.build() (diff)
downloadSubconscious-java-f35878cbe3e5e7e04e43561fcb0b218cc83e761f.tar.gz
Subconscious-java-f35878cbe3e5e7e04e43561fcb0b218cc83e761f.zip
Correct BufferStrategy rendering
Diffstat (limited to '')
-rw-r--r--src/subconscious/graphics/Scene.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/subconscious/graphics/Scene.java b/src/subconscious/graphics/Scene.java
index 1c5002d..bbc98eb 100644
--- a/src/subconscious/graphics/Scene.java
+++ b/src/subconscious/graphics/Scene.java
@@ -121,11 +121,16 @@ public abstract class Scene extends JPanel
}
}
- Graphics2D g = (Graphics2D) this.buffer.getDrawGraphics();
+ do {
+ do {
+ Graphics2D g = (Graphics2D) this.buffer.getDrawGraphics();
+ this.render(g);
+ g.dispose();
+ // repeat if the rendering buffer contents were restored
+ } while (this.buffer.contentsRestored());
+ // repeat if the drawing buffer contents were lost
+ } while (this.buffer.contentsLost());
- this.render(g);
-
- g.dispose();
this.buffer.show();
lastUpdateTime = currentUpdateTime;