summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp11
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/os/os.cpp9
-rw-r--r--core/os/os.h4
4 files changed, 26 insertions, 1 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index f951237971..94d9e22a1e 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -708,6 +708,15 @@ _OS::ScreenOrientation _OS::get_screen_orientation() const {
return ScreenOrientation(OS::get_singleton()->get_screen_orientation());
}
+void _OS::set_keep_screen_on(bool p_enabled) {
+
+ OS::get_singleton()->set_keep_screen_on(p_enabled);
+}
+
+bool _OS::is_keep_screen_on() const {
+
+ return OS::get_singleton()->is_keep_screen_on();
+}
String _OS::get_system_dir(SystemDir p_dir) const {
@@ -775,6 +784,8 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_screen_orientation","orientation"),&_OS::set_screen_orientation);
ObjectTypeDB::bind_method(_MD("get_screen_orientation"),&_OS::get_screen_orientation);
+ ObjectTypeDB::bind_method(_MD("set_keep_screen_on","enabled"),&_OS::set_keep_screen_on);
+ ObjectTypeDB::bind_method(_MD("is_keep_screen_on"),&_OS::is_keep_screen_on);
ObjectTypeDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second);
ObjectTypeDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 62572d7761..e03657f3a0 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -262,6 +262,9 @@ public:
void set_screen_orientation(ScreenOrientation p_orientation);
ScreenOrientation get_screen_orientation() const;
+ void set_keep_screen_on(bool p_enabled);
+ bool is_keep_screen_on() const;
+
void set_time_scale(float p_scale);
float get_time_scale();
diff --git a/core/os/os.cpp b/core/os/os.cpp
index be447d511e..e93038f854 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -112,6 +112,14 @@ float OS::get_target_fps() const {
return _target_fps;
}
+void OS::set_keep_screen_on(bool p_enabled) {
+ _keep_screen_on=p_enabled;
+}
+
+bool OS::is_keep_screen_on() const {
+ return _keep_screen_on;
+}
+
void OS::set_low_processor_usage_mode(bool p_enabled) {
low_processor_usage_mode=p_enabled;
@@ -520,6 +528,7 @@ OS::OS() {
frames_drawn=0;
singleton=this;
ips=60;
+ _keep_screen_on=true; // set default value to true, because this had been true before godot 2.0.
low_processor_usage_mode=false;
_verbose_stdout=false;
_frame_delay=0;
diff --git a/core/os/os.h b/core/os/os.h
index 83ea2c2101..bc3fad302a 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -46,6 +46,7 @@ class OS {
String _custom_level;
List<String> _cmdline;
int ips;
+ bool _keep_screen_on;
bool low_processor_usage_mode;
bool _verbose_stdout;
String _local_clipboard;
@@ -180,7 +181,8 @@ public:
virtual float get_frames_per_second() const { return _fps; };
-
+ virtual void set_keep_screen_on(bool p_enabled);
+ virtual bool is_keep_screen_on() const;
virtual void set_low_processor_usage_mode(bool p_enabled);
virtual bool is_in_low_processor_usage_mode() const;