summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Etcheverry <neikeq@users.noreply.github.com>2017-09-16 12:51:04 +0200
committerGitHub <noreply@github.com>2017-09-16 12:51:04 +0200
commit9c71b7b91f7215828951c96f3d75b55765bdbd5a (patch)
tree2343d20f4bf93ee66613076feef6b89370b9359d
parent62cb43bb8dec8f5078012b58ff06a2077078565f (diff)
parentf1f8fd1b68aa47e8a199c11599ffa7c4af39c486 (diff)
Merge pull request #11316 from neikeq/aaaaah
Adds _OS::PowerState enum
-rw-r--r--core/bind/core_bind.cpp14
-rw-r--r--core/bind/core_bind.h11
2 files changed, 17 insertions, 8 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index d0acd04497..ab9c107d7a 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -440,8 +440,8 @@ bool _OS::is_vsync_enabled() const {
return OS::get_singleton()->is_vsync_enabled();
}
-OS::PowerState _OS::get_power_state() {
- return OS::get_singleton()->get_power_state();
+_OS::PowerState _OS::get_power_state() {
+ return _OS::PowerState(OS::get_singleton()->get_power_state());
}
int _OS::get_power_seconds_left() {
@@ -1142,11 +1142,11 @@ void _OS::_bind_methods() {
BIND_ENUM_CONSTANT(SYSTEM_DIR_PICTURES);
BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_UNKNOWN);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_ON_BATTERY);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_NO_BATTERY);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_CHARGING);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_CHARGED);
+ BIND_ENUM_CONSTANT(POWERSTATE_UNKNOWN);
+ BIND_ENUM_CONSTANT(POWERSTATE_ON_BATTERY);
+ BIND_ENUM_CONSTANT(POWERSTATE_NO_BATTERY);
+ BIND_ENUM_CONSTANT(POWERSTATE_CHARGING);
+ BIND_ENUM_CONSTANT(POWERSTATE_CHARGED);
}
_OS::_OS() {
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 0578c2b80f..fc28ada0f8 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -97,6 +97,14 @@ protected:
static _OS *singleton;
public:
+ enum PowerState {
+ POWERSTATE_UNKNOWN, /**< cannot determine power status */
+ POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
+ POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
+ POWERSTATE_CHARGING, /**< Plugged in, charging battery */
+ POWERSTATE_CHARGED /**< Plugged in, battery charged */
+ };
+
enum Weekday {
DAY_SUNDAY,
DAY_MONDAY,
@@ -303,7 +311,7 @@ public:
void set_use_vsync(bool p_enable);
bool is_vsync_enabled() const;
- OS::PowerState get_power_state();
+ PowerState get_power_state();
int get_power_seconds_left();
int get_power_percent_left();
@@ -312,6 +320,7 @@ public:
_OS();
};
+VARIANT_ENUM_CAST(_OS::PowerState);
VARIANT_ENUM_CAST(_OS::Weekday);
VARIANT_ENUM_CAST(_OS::Month);
VARIANT_ENUM_CAST(_OS::SystemDir);