summaryrefslogtreecommitdiff
path: root/platform/uwp
diff options
context:
space:
mode:
authorJulian Murgia <the.straton@gmail.com>2016-07-23 13:15:55 +0200
committerRĂ©mi Verschelde <rverschelde@gmail.com>2017-03-04 18:04:29 +0100
commit94103c0c025f04e75d5e163d9f0bdde27bb0c848 (patch)
treed5bb55acd30270cace54dae5537b009887de1e68 /platform/uwp
parentef174abf6d640e69c402b5e9628743173c313439 (diff)
Add API to access battery power state
Done: - X11, server (tested) - Windows (developed, would be nice to retest) - OSX (not tested) Prepared (not developed): - Android (code is here, but may not compile) - iphone - winrt - bb10 - haiku - javascript
Diffstat (limited to 'platform/uwp')
-rw-r--r--platform/uwp/os_uwp.cpp14
-rw-r--r--platform/uwp/os_uwp.h8
2 files changed, 22 insertions, 0 deletions
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 61b8a1c240..f2a99fe62c 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -292,6 +292,8 @@ void OSUWP::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio
ERR_PRINT("Initializing audio failed.");
}
+ power_manager = memnew ( PowerWinRT );
+
managed_object->update_clipboard();
Clipboard::ContentChanged += ref new EventHandler<Platform::Object^>(managed_object, &ManagedType::on_clipboard_changed);
@@ -919,6 +921,18 @@ String OSUWP::get_data_dir() const {
return String(data_folder->Path->Data()).replace("\\", "/");
}
+PowerState OSWinrt::get_power_state() {
+ return power_manager->get_power_state();
+}
+
+int OSWinrt::get_power_seconds_left() {
+ return power_manager->get_power_seconds_left();
+}
+
+int OSWinrt::get_power_percent_left() {
+ return power_manager->get_power_percent_left();
+}
+
OSUWP::OSUWP() {
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index f65aa2d8d9..72cc8a7854 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -42,12 +42,14 @@
#include "core/ustring.h"
#include "main/input_default.h"
#include "joypad_uwp.h"
+#include "power_winrt.h"
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -111,6 +113,8 @@ private:
AudioDriverXAudio2 audio_driver;
+ PowerWinRT *power_manager;
+
MouseMode mouse_mode;
bool alt_mem;
bool gr_mem;
@@ -260,6 +264,10 @@ public:
virtual bool get_swap_ok_cancel() { return true; }
void input_event(InputEvent &p_event);
+
+ virtual PowerState get_power_state();
+ virtual int get_power_seconds_left();
+ virtual int get_power_percent_left();
void queue_key_event(KeyEvent &p_event);