diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/com/aurellem/capture/IsoTimer.java	Tue Oct 25 12:03:01 2011 -0700
     1.3 @@ -0,0 +1,30 @@
     1.4 +package com.aurellem.capture;
     1.5 +
     1.6 +import com.jme3.system.Timer;
     1.7 +
     1.8 +public class IsoTimer extends Timer {
     1.9 +
    1.10 +	private float framerate;
    1.11 +	private int ticks;
    1.12 +	
    1.13 +	public IsoTimer(float framerate){
    1.14 +		this.framerate = framerate;
    1.15 +		this.ticks = 0;}
    1.16 +	
    1.17 +	public long getTime() {
    1.18 +		return (long) (this.ticks / this.framerate);}
    1.19 +	
    1.20 +	public long getResolution() {
    1.21 +		return 1000000000L;}
    1.22 +	
    1.23 +	public float getFrameRate() {
    1.24 +		return this.framerate;}
    1.25 +	
    1.26 +	public float getTimePerFrame() {
    1.27 +		return (float) (1.0f / this.framerate);}
    1.28 +
    1.29 +	public void update() {this.ticks++;}
    1.30 +	
    1.31 +	public void reset() {this.ticks = 0;}
    1.32 +
    1.33 +}