|
@@ -1,6 +1,5 @@ |
|
|
package edu.stuy.goldfish;
|
|
|
package edu.stuy.goldfish;
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
import java.awt.Canvas;
|
|
|
import java.awt.Canvas;
|
|
|
import java.awt.Dimension;
|
|
|
import java.awt.Dimension;
|
|
|
import java.awt.Graphics;
|
|
|
import java.awt.Graphics;
|
|
@@ -99,7 +98,7 @@ public class Render extends Canvas implements Runnable { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void sleep() {
|
|
|
public void sleep() {
|
|
|
long since = (new Date()).getTime() - _last_tick;
|
|
|
|
|
|
|
|
|
long since = System.currentTimeMillis() - _last_tick;
|
|
|
if (since < 1000 / max_fps) {
|
|
|
if (since < 1000 / max_fps) {
|
|
|
try {
|
|
|
try {
|
|
|
Thread.sleep(1000 / max_fps - since);
|
|
|
Thread.sleep(1000 / max_fps - since);
|
|
@@ -108,7 +107,7 @@ public class Render extends Canvas implements Runnable { |
|
|
return;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
_last_tick = (new Date()).getTime();
|
|
|
|
|
|
|
|
|
_last_tick = System.currentTimeMillis();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void setGrid(Grid g) {
|
|
|
public void setGrid(Grid g) {
|
|
|