瀏覽代碼

Use System.currentTimeMillis()

master
Ben Kurtovic 12 年之前
父節點
當前提交
361b560d36
共有 1 個檔案被更改,包括 2 行新增3 行删除
  1. +2
    -3
      src/Render.java

+ 2
- 3
src/Render.java 查看文件

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


Loading…
取消
儲存