Shoved resolution down into ints for better wrap handling

This commit is contained in:
Caspian Rychlik-Prince 2004-12-07 00:23:20 +00:00
parent 9c0095b02c
commit 668e59f52d
1 changed files with 5 additions and 5 deletions

View File

@ -54,13 +54,13 @@ public class Timer {
private static int queryCount = 0; private static int queryCount = 0;
// Globally keeps track of time for all instances of Timer // Globally keeps track of time for all instances of Timer
private static long currentTime; private static int currentTime;
// When the timer was started // When the timer was started
private long startTime; private int startTime;
// The last time recorded by getTime() // The last time recorded by getTime()
private long lastTime; private int lastTime;
// Whether the timer is paused // Whether the timer is paused
private boolean paused; private boolean paused;
@ -133,7 +133,7 @@ public class Timer {
* @param newTime the new time, in seconds * @param newTime the new time, in seconds
*/ */
public void set(float newTime) { public void set(float newTime) {
long newTimeInTicks = (long) ((double) newTime * (double) resolution); int newTimeInTicks = (int) ((double) newTime * (double) resolution);
startTime = currentTime - newTimeInTicks; startTime = currentTime - newTimeInTicks;
lastTime = newTimeInTicks; lastTime = newTimeInTicks;
} }
@ -144,7 +144,7 @@ public class Timer {
* from it. * from it.
*/ */
public static void tick() { public static void tick() {
currentTime = Sys.getTime(); currentTime = (int) Sys.getTime();
// Periodically refresh the timer resolution: // Periodically refresh the timer resolution:
queryCount ++; queryCount ++;