|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.golden.gamedev.engine.timer.SystemTimer
public class SystemTimer
The standard timer used in Golden T Game Engine (GTGE) Frame Work.
This timer is using System.currentTimeMillis() and support for time drift calculation.
See BaseTimer for how to use timer
engine separated from Golden T Game Engine (GTGE) Frame Work.
| Constructor Summary | |
|---|---|
SystemTimer()
Constructs new SystemTimer. |
|
| Method Summary | |
|---|---|
int |
getCurrentFPS()
Returns timer current frame per second. |
int |
getFPS()
Returns the requested frame per second. |
long |
getTime()
Returns timer current time in milliseconds. |
boolean |
isRunning()
Returns whether the timer is currently running or not. |
void |
refresh()
Refreshs timer elapsed time. |
void |
setFPS(int fps)
Sets this timer target frame per second to specified frame per second. |
long |
sleep()
Sleeps for awhile to achieve requested frame per second and returns the elapsed time since last sleep. |
void |
startTimer()
Starts the timer, please set appropriate frame per second first before calling this method. |
void |
stopTimer()
Stops this timer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SystemTimer()
SystemTimer.
| Method Detail |
|---|
public void startTimer()
BaseTimer
startTimer in interface BaseTimerBaseTimer.getCurrentFPS(),
BaseTimer.getFPS()public void stopTimer()
BaseTimer
stopTimer in interface BaseTimerpublic long sleep()
BaseTimerTo call this method, timer must be in running state.
sleep in interface BaseTimerBaseTimer.startTimer(),
BaseTimer.getFPS()public boolean isRunning()
BaseTimer
Timer is running when BaseTimer.startTimer() is called.
isRunning in interface BaseTimerBaseTimer.startTimer()public int getCurrentFPS()
BaseTimerCurrent frame per second is the actual frame per second the player machine could achieve.
Because of one and many things (ie: the incapability of the player machine), the current frame per second can be differ from the requested frame per second.
getCurrentFPS in interface BaseTimerBaseTimer.getFPS(),
BaseTimer.startTimer()public int getFPS()
BaseTimer
Requested frame per second is the target frame per second to achieve
(the number set in BaseTimer.setFPS(int) method).
Because of one and many things (ie: the incapability of the player machine), a high requested frame per second may not always be achieved.
To get the actual fps see BaseTimer.getCurrentFPS().
getFPS in interface BaseTimerBaseTimer.getCurrentFPS(),
BaseTimer.setFPS(int)public void setFPS(int fps)
BaseTimerThis timer is ordered to run as fast as this frame per second, but the actual fps achieved is depending of the player machine ability.
setFPS in interface BaseTimerfps - requested frame per secondBaseTimer.getCurrentFPS()public long getTime()
BaseTimer
getTime in interface BaseTimerpublic void refresh()
BaseTimer
refresh in interface BaseTimer
|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||