Corrected battery percentage on iOS (thanks, Felix!).
authorRyan C. Gordon <icculus@icculus.org>
Mon, 17 Feb 2014 11:46:23 -0500
changeset 8222 01a7b69c4fb7
parent 8221 6ded2087e346
child 8223 18ffe88a2148
Corrected battery percentage on iOS (thanks, Felix!). Fixes Bugzilla #2397.
src/power/uikit/SDL_syspower.m
--- a/src/power/uikit/SDL_syspower.m	Sun Feb 16 00:04:15 2014 +0100
+++ b/src/power/uikit/SDL_syspower.m	Mon Feb 17 11:46:23 2014 -0500
@@ -87,7 +87,7 @@
     }
 
     const float level = [uidev batteryLevel];
-    *percent = ( (level < 0.0f) ? -1 : (((int) (level + 0.5f)) * 100) );
+    *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) );
     return SDL_TRUE;            /* always the definitive answer on iPhoneOS. */
 }