summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujita <fujita@brilliantservice.co.jp>2012-04-03 15:53:25 +0900
committerKeun young Park <keunyoung@google.com>2012-04-26 18:05:00 -0700
commit800662a3696ccd22a7d9d33cb2a5ee198df2c6cd (patch)
treecdfe21f9072ebd4d629e9d47b18368e5b6c2ba73
parentbf8b8c8eae8f7df938db8194854d48a57cc3102e (diff)
downloadreplicaisland-800662a3696ccd22a7d9d33cb2a5ee198df2c6cd.tar.gz
-modify calculating frame rate per second (FPS) to fix divide-by-zero crash issue after too slow task switch. Signed-off-by: fujita <fujita@brilliantservice.co.jp>
-rw-r--r--src/com/replica/replicaisland/GameThread.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/replica/replicaisland/GameThread.java b/src/com/replica/replicaisland/GameThread.java
index ad5c08e..7ee47dd 100644
--- a/src/com/replica/replicaisland/GameThread.java
+++ b/src/com/replica/replicaisland/GameThread.java
@@ -83,9 +83,9 @@ public class GameThread implements Runnable {
if (mProfileTime > PROFILE_REPORT_DELAY * 1000) {
final long averageFrameTime = mProfileTime / mProfileFrames;
DebugLog.d("Game Profile", "Average: " + averageFrameTime);
+ mGameRoot.sSystemRegistry.hudSystem.setFPS((int)(1000 * mProfileFrames / mProfileTime));
mProfileTime = 0;
mProfileFrames = 0;
- mGameRoot.sSystemRegistry.hudSystem.setFPS(1000 / (int)averageFrameTime);
}
}
// If the game logic completed in less than 16ms, that means it's running