diff options
author | fujita <fujita@brilliantservice.co.jp> | 2012-04-03 15:53:25 +0900 |
---|---|---|
committer | Keun young Park <keunyoung@google.com> | 2012-04-26 18:05:00 -0700 |
commit | 800662a3696ccd22a7d9d33cb2a5ee198df2c6cd (patch) | |
tree | cdfe21f9072ebd4d629e9d47b18368e5b6c2ba73 | |
parent | bf8b8c8eae8f7df938db8194854d48a57cc3102e (diff) | |
download | replicaisland-800662a3696ccd22a7d9d33cb2a5ee198df2c6cd.tar.gz |
Fix a divide-by-zero caseandroid-cts-4.1_r4android-cts-4.1_r2android-cts-4.1_r1android-4.1.2_r2.1android-4.1.2_r2android-4.1.2_r1android-4.1.1_r6.1android-4.1.1_r6android-4.1.1_r5android-4.1.1_r4android-4.1.1_r3android-4.1.1_r2android-4.1.1_r1.1android-4.1.1_r1tools_r21jb-releasejb-mr0-releasejb-dev
-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.java | 2 |
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 |