I search for methods to create a stopwatch on libgdx and came across with this:
public void trigger(float delta){
playTime += delta;
playTimeRounded = ((double)Math.round(playTime * 100) / 100);
Gdx.app.log("deltaTime", delta + "");
}
But its not accurate and its much faster. How can i create an accurate stopwatch?
trigger
function. \$\endgroup\$trigger
from render method something like thistrigger( Gdx.graphics.getDeltaTime() )
. In accordance with documentationgetDeltaTime
returns smoothed delta time over n frames. So, you should changeGdx.graphics.getDeltaTime()
toGdx.graphics.getRawDeltaTime()
. \$\endgroup\$