Added Android implementation

This commit is contained in:
Mario Liebisch 2015-01-16 23:22:52 +01:00
parent 10d0f500ae
commit 471979908f

View file

@ -25,8 +25,11 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Android/SleepImpl.hpp>
#include <SFML/System/Android/PowerImpl.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Lock.hpp>
#include <android/native_activity.h>
#include <android/window.h>
namespace sf
{
@ -35,6 +38,16 @@ namespace priv
////////////////////////////////////////////////////////////
bool setPowersavingEnabledImpl(bool enabled)
{
ActivityStates* states = getActivity(NULL);
Lock(states->mutex);
if (enabled)
{
ANativeActivity_setWindowFlags(states->activity, 0, AWINDOW_FLAG_KEEP_SCREEN_ON);
}
else
{
ANativeActivity_setWindowFlags(states->activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
}
return false;
}