de.rico.engine.util
Class FPSCounter

java.lang.Object
  extended by de.rico.engine.util.FPSCounter

public class FPSCounter
extends java.lang.Object

This class can be used to calculate and display the framerate (frames per second)

Author:
Frank Bruns

Constructor Summary
FPSCounter(int y, int rightMargin)
          Creates new frames per second counter.
 
Method Summary
 void draw(javax.media.opengl.GL gl)
          Draws the framerate to the upper left corner of the screen.
 java.lang.String toString()
           
 void update(long elapsedTime)
          Updates the frames per second counter to calculate the correct framerate.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FPSCounter

public FPSCounter(int y,
                  int rightMargin)
Creates new frames per second counter.

Parameters:
y - y coordinate
rightMargin - distance from right screen margin
Method Detail

update

public void update(long elapsedTime)
Updates the frames per second counter to calculate the correct framerate.

Parameters:
elapsedTime - time between two frames

draw

public void draw(javax.media.opengl.GL gl)
Draws the framerate to the upper left corner of the screen.

Parameters:
gl -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object