This commit is contained in:
Pan 2019-05-20 20:48:37 +12:00
parent e926201e0a
commit 86c090c1e6

View File

@ -594,8 +594,17 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
lastTime = thisTime; lastTime = thisTime;
} }
long sleeptime = frameInterval - (System.currentTimeMillis() - lastDraw);
if(sleeptime > 0)
try {
Thread.sleep(sleeptime);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
sleepTime = 0; /*sleepTime = 0;
while(System.currentTimeMillis()-lastDraw<frameInterval){ while(System.currentTimeMillis()-lastDraw<frameInterval){
try { try {
@ -605,7 +614,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
} }*/