| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | misrepresented as being the original software. |
| | | 3. This notice may not be removed or altered from any source distribution. |
| | | */ |
| | | #include "SDL_config.h" |
| | | #include "../../SDL_internal.h" |
| | | |
| | | #ifndef SDL_POWER_DISABLED |
| | | #if SDL_POWER_UIKIT |
| | |
| | | } |
| | | |
| | | const float level = [uidev batteryLevel]; |
| | | *percent = ( (level < 0.0f) ? -1 : (((int) (level + 0.5f)) * 100) ); |
| | | return SDL_TRUE; /* always the definitive answer on iPhoneOS. */ |
| | | *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) ); |
| | | return SDL_TRUE; /* always the definitive answer on iOS. */ |
| | | } |
| | | |
| | | #endif /* SDL_POWER_UIKIT */ |