mLastTickInNanoSeconds is the renderStart

because:
this.mLastTickInNanoSeconds = renderEnd - renderInterval;
renderInterval = renderEnd - renderStart
so:
this.mLastTickInNanoSeconds = renderEnd - ( renderEnd - renderStart );
so:
this.mLastTickInNanoSeconds = renderStart ;

so:
no need nanoTime() twice
This commit is contained in:
胖梁 2014-08-14 17:07:04 +08:00
parent c673955d5d
commit 3619fb943a
1 changed files with 1 additions and 4 deletions

View File

@ -100,11 +100,8 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer {
/* /*
* Render time MUST be counted in, or the FPS will slower than appointed. * Render time MUST be counted in, or the FPS will slower than appointed.
*/ */
final long renderStart = System.nanoTime(); this.mLastTickInNanoSeconds = System.nanoTime();
Cocos2dxRenderer.nativeRender(); Cocos2dxRenderer.nativeRender();
final long renderEnd = System.nanoTime();
final long renderInterval = renderEnd - renderStart;
this.mLastTickInNanoSeconds = renderEnd - renderInterval;
} }
} }