|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object game.CGameLoop
public class CGameLoop
Game loop implementation, can be frame or time based. Associated to an IGame object.
Field Summary | |
---|---|
static int |
FRAME_BASED
|
private java.lang.Thread |
m_animationThread
|
private int |
m_animationType
|
private CAverageTimer |
m_averageTimer
|
private float |
m_fps
|
private float |
m_fTheoricFps
|
private IGame |
m_game
|
private long |
m_msLastRecordedTime
|
private long |
m_msTheoricFrameTime
|
private int |
m_nbFramesPerRecord
|
private int |
m_nbRecordedFrames
|
static int |
TIME_BASED
|
Constructor Summary | |
---|---|
CGameLoop(IGame game,
int animationType,
float fps)
Constructor. |
Method Summary | |
---|---|
private float |
getDt()
Computes the amount of time the animation should advance of. |
float |
getFps()
Effective framerate. |
private void |
initRecord()
Used for effective framerate evaluation. |
void |
run()
Runs the loop thread. |
void |
setTheoricFps(float fTheoricFps)
Sets the theoric framerate. |
void |
start()
Inits and starts the loop thread. |
void |
stop()
Stops the loop thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TIME_BASED
public static final int FRAME_BASED
private float m_fTheoricFps
private float m_fps
private long m_msTheoricFrameTime
private long m_msLastRecordedTime
private int m_nbFramesPerRecord
private int m_nbRecordedFrames
private int m_animationType
private volatile java.lang.Thread m_animationThread
private IGame m_game
private CAverageTimer m_averageTimer
Constructor Detail |
---|
public CGameLoop(IGame game, int animationType, float fps)
game
- : the game to be animated and drawn by this loopanimationType
- : frame or time basedfps
- : the theoric framerate to sustain.Method Detail |
---|
public void start()
public void stop()
public void run()
run
in interface java.lang.Runnable
private final float getDt()
public void setTheoricFps(float fTheoricFps)
fTheoricFps
- : the theoric framerate to sustain.public float getFps()
private void initRecord()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |