Skip to content

anonymous /DB.java
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
More sophisticated double-buffered rendering
private VolatileImage drawImage = null;
private int drawImageWidth = 800;
private int drawImageHeight = 600;
public void render(BufferStrategy strategy) {
if (drawImage == null) {
drawImage = createVolatileImage(drawImageWidth, drawImageHeight);
}
Graphics2D drawGraphics = (Graphics2D) drawImage.getGraphics();
// TODO: use `drawGraphics` to draw game graphics (background, platforms, player, etc.)
// render a single frame:
do {
do {
Graphics2D renderGraphics = (Graphics2D) strategy.getDrawGraphics();
renderGraphics.drawImage(drawImage, 0, 0, null);
renderGraphics.dispose();
} while (strategy.contentsRestored());
strategy.show();
} while (strategy.contentsLost());
Toolkit.getDefaultToolkit().sync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.