diff --git a/engine/src/core/com/jme3/app/Application.java b/engine/src/core/com/jme3/app/Application.java index 8f7d3563d..31f9a9d29 100644 --- a/engine/src/core/com/jme3/app/Application.java +++ b/engine/src/core/com/jme3/app/Application.java @@ -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(){ // aquire important objects // from the context 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(); }