/** * Returns the time in seconds. The timer starts * at 0.0 seconds. * * @return the current time in seconds */ public float getTimeInSeconds() { return getTime() / (float) getResolution(); }
public void sync(int fps) { long timeNow; long gapTo; long savedTimeLate; gapTo = timer.getResolution() / fps + timeThen; timeNow = timer.getTime(); savedTimeLate = timeLate; try { while (gapTo > timeNow + savedTimeLate) { Thread.sleep(1); timeNow = timer.getTime(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (gapTo < timeNow) { timeLate = timeNow - gapTo; } else { timeLate = 0; } timeThen = timeNow; }
t = t2; if (total > timer.getResolution()) { fps = frames; total = 0;
/** * Returns the time in seconds. The timer starts * at 0.0 seconds. * * @return the current time in seconds */ public float getTimeInSeconds() { return getTime() / (float) getResolution(); }
/** * Returns the time in seconds. The timer starts * at 0.0 seconds. * * @return the current time in seconds */ public float getTimeInSeconds() { return getTime() / (float) getResolution(); }
public void sync(int fps) { long timeNow; long gapTo; long savedTimeLate; gapTo = timer.getResolution() / fps + timeThen; timeNow = timer.getTime(); savedTimeLate = timeLate; try { while (gapTo > timeNow + savedTimeLate) { Thread.sleep(1); timeNow = timer.getTime(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (gapTo < timeNow) { timeLate = timeNow - gapTo; } else { timeLate = 0; } timeThen = timeNow; }
public void sync(int fps) { long timeNow; long gapTo; long savedTimeLate; gapTo = timer.getResolution() / fps + timeThen; timeNow = timer.getTime(); savedTimeLate = timeLate; try { while (gapTo > timeNow + savedTimeLate) { Thread.sleep(1); timeNow = timer.getTime(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (gapTo < timeNow) { timeLate = timeNow - gapTo; } else { timeLate = 0; } timeThen = timeNow; }