Mercurial > jmeCapture
comparison src/com/aurellem/capture/IsoTimer.java @ 4:edaa7e7806e4
migrated IsoTimer
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 12:03:01 -0700 |
parents | |
children | 6484a820e27d |
comparison
equal
deleted
inserted
replaced
3:a92de00f0414 | 4:edaa7e7806e4 |
---|---|
1 package com.aurellem.capture; | |
2 | |
3 import com.jme3.system.Timer; | |
4 | |
5 public class IsoTimer extends Timer { | |
6 | |
7 private float framerate; | |
8 private int ticks; | |
9 | |
10 public IsoTimer(float framerate){ | |
11 this.framerate = framerate; | |
12 this.ticks = 0;} | |
13 | |
14 public long getTime() { | |
15 return (long) (this.ticks / this.framerate);} | |
16 | |
17 public long getResolution() { | |
18 return 1000000000L;} | |
19 | |
20 public float getFrameRate() { | |
21 return this.framerate;} | |
22 | |
23 public float getTimePerFrame() { | |
24 return (float) (1.0f / this.framerate);} | |
25 | |
26 public void update() {this.ticks++;} | |
27 | |
28 public void reset() {this.ticks = 0;} | |
29 | |
30 } |