Created
February 11, 2017 03:44
-
-
Save matt11matthew/4209c52e1f1064204dcb862646dac0d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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