diff options
author | Nao Pross <naopross@thearcway.org> | 2018-11-20 20:39:18 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-11-20 20:39:18 +0100 |
commit | f35878cbe3e5e7e04e43561fcb0b218cc83e761f (patch) | |
tree | 85f8174cebda55c3cea6b00014020a443dfe2eb4 | |
parent | Remove Scene.absoluteRender(), add Scene.build() (diff) | |
download | Subconscious-java-f35878cbe3e5e7e04e43561fcb0b218cc83e761f.tar.gz Subconscious-java-f35878cbe3e5e7e04e43561fcb0b218cc83e761f.zip |
Correct BufferStrategy rendering
-rw-r--r-- | src/subconscious/graphics/Scene.java | 13 |
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; |