Mercurial > jmeCapture
comparison src/com/aurellem/capture/IsoTimer.java @ 62:f5e52169f056
updated to work with new jme changes
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 14 Dec 2011 17:43:52 -0700 |
parents | 5afa49c5a7d3 |
children | ddb300c5335f |
comparison
equal
deleted
inserted
replaced
61:76581e11fb72 | 62:f5e52169f056 |
---|---|
34 * | 34 * |
35 */ | 35 */ |
36 | 36 |
37 public class IsoTimer extends Timer { | 37 public class IsoTimer extends Timer { |
38 | 38 |
39 private float framerate; | 39 private long framerate; |
40 private int ticks; | 40 private int ticks; |
41 | |
42 public IsoTimer(float framerate){ | |
43 this.framerate = framerate; | |
44 this.ticks = 0; | |
45 } | |
46 | |
47 public long getTime() { | |
48 return (long) (this.ticks / this.framerate); | |
49 } | |
50 | |
51 public long getResolution() { | |
52 return 1000000000L; | |
53 } | |
54 | |
55 public float getFrameRate() { | |
56 return this.framerate; | |
57 } | |
58 | |
59 public float getTimePerFrame() { | |
60 return (float) (1.0f / this.framerate); | |
61 } | |
62 | 41 |
63 public void update() {this.ticks++;} | 42 public IsoTimer(float framerate){ |
64 | 43 this.framerate = (long) framerate; |
65 public void reset() {this.ticks = 0;} | 44 this.ticks = 0; |
45 } | |
46 | |
47 public long getTime() { | |
48 return this.ticks; | |
49 } | |
50 | |
51 public long getResolution() { | |
52 return (long) framerate; | |
53 } | |
54 | |
55 public float getFrameRate() { | |
56 return this.framerate; | |
57 } | |
58 | |
59 public float getTimePerFrame() { | |
60 return (float) (1.0f / this.framerate); | |
61 } | |
62 | |
63 public void update() {this.ticks++;} | |
64 | |
65 public void reset() {this.ticks = 0;} | |
66 | 66 |
67 } | 67 } |