GTGE API

com.golden.gamedev.engine.timer
Class FPSCounter

java.lang.Object
  extended by com.golden.gamedev.engine.timer.FPSCounter

public class FPSCounter
extends Object

A utility class to calculate timer frame per seconds (FPS) in convenient way.

How to use :

    FPSCounter counter;

    // game loop
    while (true) {
       counter.getCurrentFPS(); // returns current fps

       counter.calculateFPS();  // calculating fps
    }
 


Constructor Summary
FPSCounter()
          Creates new FPSCounter.
 
Method Summary
 void calculateFPS()
          The main method that calculating the frame per second.
 int getCurrentFPS()
          Returns current FPS.
 void refresh()
          Refresh the FPS counter, reset the fps to 0 and the timer counter to start counting from current time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FPSCounter

public FPSCounter()
Creates new FPSCounter.

Method Detail

refresh

public void refresh()
Refresh the FPS counter, reset the fps to 0 and the timer counter to start counting from current time.


calculateFPS

public void calculateFPS()
The main method that calculating the frame per second.


getCurrentFPS

public int getCurrentFPS()
Returns current FPS.

See Also:
calculateFPS()

GTGE API

Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to license terms.
GoldenStudios.or.id