Skip to content

Instantly share code, notes, and snippets.

@matt11matthew
Created February 11, 2017 03:44
Show Gist options
  • Save matt11matthew/4209c52e1f1064204dcb862646dac0d9 to your computer and use it in GitHub Desktop.
Save matt11matthew/4209c52e1f1064204dcb862646dac0d9 to your computer and use it in GitHub Desktop.
public synchronized void start() {
this.thread = new Thread(this);
this.thread.start();
this.running = true;
}
public void render() {
BufferStrategy bufferStrategy = getBufferStrategy();
if (bufferStrategy == null) {
createBufferStrategy(3);
return;
}
this.screen.render(bufferStrategy.getDrawGraphics());
bufferStrategy.show();
}
@SuppressWarnings("static-access")
@Override
public void run() {
while (running) {
render();
try {
this.thread.sleep(10L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment