gameframe.engines.jdk12x
Class CTimer
java.lang.Object
|
+--gameframe.engines.jdk12x.CTimer
- All Implemented Interfaces:
- Finalizable, Timer
- class CTimer
- extends java.lang.Object
- implements Timer, Finalizable
Interface for a generic timer class that times the (average or exact, depending
on implementation) time between the calls made to the calculateTime() method.
Useful for e.g. finding out how long a main game loop takes and refining some
timing accordingly.
- Since:
- GameFrame for Java 0.9
- Version:
- GameFrame for Java 0.9.3
Method Summary |
float |
calculateTime()
When invoked calculates the time that has expired since the last invokation in
milliseconds. |
void |
finalize()
Frees all the resources used by this class. |
Methods inherited from class java.lang.Object |
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
m_engineFactory
private CEngineFactory m_engineFactory
- The engine factory that created this timer.
m_averageTime
private float m_averageTime
- The average time that has gone in one invokation of calculateTime().
m_count
private int m_count
- The number of invokations of calculateTime().
m_lastCalculationTime
private long m_lastCalculationTime
- The last time the average value was calculated.
CTimer
CTimer(CEngineFactory engineFactory)
- Constructs a timer.
- Parameters:
engineFactory
- The engine factory that is to be notified about
finalization.
calculateTime
public float calculateTime()
- When invoked calculates the time that has expired since the last invokation in
milliseconds.
- Specified by:
calculateTime
in interface Timer
- Returns:
- The time that has gone since last invokation.
finalize
public void finalize()
- Frees all the resources used by this class.
- Specified by:
finalize
in interface Timer
- Overrides:
finalize
in class java.lang.Object