Move Win32 GetBatteryInfo into Windows and UWP platforms impl
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Platform/MessageBox.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Platform/BatteryInfo.h"
|
||||
#include "Engine/Input/Input.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "UWPWindow.h"
|
||||
@@ -114,6 +115,21 @@ void UWPPlatform::Exit()
|
||||
Win32Platform::Exit();
|
||||
}
|
||||
|
||||
BatteryInfo UWPPlatform::GetBatteryInfo()
|
||||
{
|
||||
BatteryInfo info;
|
||||
SYSTEM_POWER_STATUS status;
|
||||
GetSystemPowerStatus(&status);
|
||||
info.BatteryLifePercent = (float)status.BatteryLifePercent / 255.0f;
|
||||
if (status.BatteryFlag & 8)
|
||||
info.State = BatteryInfo::States::BatteryCharging;
|
||||
else if (status.BatteryFlag & 1 || status.BatteryFlag & 2 || status.BatteryFlag & 4)
|
||||
info.State = BatteryInfo::States::BatteryDischarging;
|
||||
else if (status.ACLineStatus == 1 || status.BatteryFlag & 128)
|
||||
info.State = BatteryInfo::States::Connected;
|
||||
return info;
|
||||
}
|
||||
|
||||
int32 UWPPlatform::GetDpi()
|
||||
{
|
||||
return SystemDpi;
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
static void Tick();
|
||||
static void BeforeExit();
|
||||
static void Exit();
|
||||
static BatteryInfo GetBatteryInfo();
|
||||
static int32 GetDpi();
|
||||
static String GetUserLocaleName();
|
||||
static String GetComputerName();
|
||||
|
||||
Reference in New Issue
Block a user