Corrected battery percentage on iOS (thanks, Felix!).
authorRyan C. Gordon <icculus@icculus.org>
Mon, 17 Feb 2014 11:46:23 -0500
changeset 822201a7b69c4fb7
parent 8221 6ded2087e346
child 8223 18ffe88a2148
Corrected battery percentage on iOS (thanks, Felix!).

Fixes Bugzilla #2397.
src/power/uikit/SDL_syspower.m
     1.1 --- a/src/power/uikit/SDL_syspower.m	Sun Feb 16 00:04:15 2014 +0100
     1.2 +++ b/src/power/uikit/SDL_syspower.m	Mon Feb 17 11:46:23 2014 -0500
     1.3 @@ -87,7 +87,7 @@
     1.4      }
     1.5  
     1.6      const float level = [uidev batteryLevel];
     1.7 -    *percent = ( (level < 0.0f) ? -1 : (((int) (level + 0.5f)) * 100) );
     1.8 +    *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) );
     1.9      return SDL_TRUE;            /* always the definitive answer on iPhoneOS. */
    1.10  }
    1.11