فهرست منبع

Corrected battery percentage on iOS (thanks, Felix!).

Fixes Bugzilla #2397.
Ryan C. Gordon 11 سال پیش
والد
کامیت
245e125e0f
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      src/power/uikit/SDL_syspower.m

+ 1 - 1
src/power/uikit/SDL_syspower.m

@@ -87,7 +87,7 @@ SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent)
     }
 
     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. */
 }