mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1680 from minggo/gles20
comment codes for FPS controlling
This commit is contained in:
commit
84b35c6d48
|
@ -79,23 +79,32 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer {
|
|||
|
||||
@Override
|
||||
public void onDrawFrame(final GL10 gl) {
|
||||
/*
|
||||
* FPS controlling algorithm is not accurate, and it will slow down FPS
|
||||
* on some devices. So comment FPS controlling code.
|
||||
*/
|
||||
|
||||
/*
|
||||
final long nowInNanoSeconds = System.nanoTime();
|
||||
final long interval = nowInNanoSeconds - this.mLastTickInNanoSeconds;
|
||||
*/
|
||||
|
||||
// should render a frame when onDrawFrame() is called or there is a
|
||||
// "ghost"
|
||||
Cocos2dxRenderer.nativeRender();
|
||||
|
||||
/*
|
||||
// fps controlling
|
||||
if (interval < Cocos2dxRenderer.sAnimationInterval) {
|
||||
try {
|
||||
// because we render it before, so we should sleep twice time interval
|
||||
Thread.sleep((Cocos2dxRenderer.sAnimationInterval - interval) * 2 / Cocos2dxRenderer.NANOSECONDSPERMICROSECOND);
|
||||
Thread.sleep((Cocos2dxRenderer.sAnimationInterval - interval) / Cocos2dxRenderer.NANOSECONDSPERMICROSECOND);
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
this.mLastTickInNanoSeconds = nowInNanoSeconds;
|
||||
*/
|
||||
}
|
||||
|
||||
// ===========================================================
|
||||
|
|
Loading…
Reference in New Issue