Added a setTimer() method for switching the default
Timer implementation. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8523 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
2c0775e3f3
commit
2a65ca4cb7
@ -197,11 +197,32 @@ public class Application implements SystemListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Timer implementation that will be used for calculating
|
||||||
|
* frame times. By default, Application will use the Timer as returned
|
||||||
|
* by the current JmeContext implementation.
|
||||||
|
*/
|
||||||
|
public void setTimer(Timer timer){
|
||||||
|
this.timer = timer;
|
||||||
|
|
||||||
|
if (timer != null) {
|
||||||
|
timer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (renderManager != null) {
|
||||||
|
renderManager.setTimer(timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initDisplay(){
|
private void initDisplay(){
|
||||||
// aquire important objects
|
// aquire important objects
|
||||||
// from the context
|
// from the context
|
||||||
settings = context.getSettings();
|
settings = context.getSettings();
|
||||||
timer = context.getTimer();
|
|
||||||
|
// Only reset the timer if a user has not already provided one
|
||||||
|
if (timer == null) {
|
||||||
|
timer = context.getTimer();
|
||||||
|
}
|
||||||
|
|
||||||
renderer = context.getRenderer();
|
renderer = context.getRenderer();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user