Mercurial > hg > ristipolku
changeset 168:159252f9480d
Fix animation choppiness.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 02 Mar 2017 12:30:19 +0200 |
parents | 7bf508d363bd |
children | 32b1c41e194a |
files | game/Engine.java |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/game/Engine.java Thu Mar 02 12:23:57 2017 +0200 +++ b/game/Engine.java Thu Mar 02 12:30:19 2017 +0200 @@ -763,6 +763,8 @@ long currTime = new Date().getTime(); g2.drawString("fps = "+ ((gameFrames * 1000) / (currTime - startTime)), G.screenDim.width - 120, 20); */ + + Toolkit.getDefaultToolkit().sync(); gameFrames++; } @@ -856,12 +858,12 @@ lauta.animate(tmp); // Repaint with a frame limiter - if (gameUpdates % 4 == 1) + if (gameUpdates % 2 == 1) repaint(); // Sleep for a moment try { - Thread.sleep(10); + Thread.sleep(15); } catch (InterruptedException x) { }