I'm getting only around 65 cycles/second... is that how slow a surfaceview is? Notice that I'm not doing ANYTHING, all of my functions are commented out. The only thing is a few if else statements, and the lock and unlocking of hte canvas.
- Code: Select all
while(mRun)
{
double diff = (System.currentTimeMillis() - lastTouchTime)/1000.0;
Log.i(TAG,"cycles/sec:"+1.0/diff);
lastTouchTime = System.currentTimeMillis();
Canvas c = null;
try {
c = mSurfaceHolder.lockCanvas(null);
synchronized (mSurfaceHolder) {
if (gameState == GAME_STATE_RUNNING)
{
//updateLandscape();
//updatePhysics();
}
else if(gameState == GAME_STATE_WON_LEVEL)
{
}
else if(gameState == GAME_STATE_PAUSE)
{
}
//doDraw(c);
}
} finally {
// do this in a finally so that if an exception is thrown
// during the above, we don't leave the Surface in an
// inconsistent state
if (c != null) {
mSurfaceHolder.unlockCanvasAndPost(c);
}
}
}

