Skip to content

Commit

Permalink
Always disable low-processor usage mode on mobile platforms
Browse files Browse the repository at this point in the history
This partially addresses godotengine#19304.
  • Loading branch information
Calinou committed Aug 2, 2020
1 parent ec9302c commit bf5d16e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@
Forces a delay between frames in the main loop (in milliseconds). This may be useful if you plan to disable vertical synchronization.
</member>
<member name="application/run/low_processor_mode" type="bool" setter="" getter="" default="false">
If [code]true[/code], enables low-processor usage mode. This setting only works on desktop platforms. The screen is not redrawn if nothing changes visually. This is meant for writing applications and editors, but is pretty useless (and can hurt performance) in most games.
If [code]true[/code], enables low-processor usage mode. The screen is not redrawn if nothing changes visually. This is meant for writing applications and editors, but is pretty useless (and can hurt performance) in most games.
[b]Note:[/b] This option won't have any effect on Android and iOS as it's not implemented yet on those platforms.
</member>
<member name="application/run/low_processor_mode_sleep_usec" type="int" setter="" getter="" default="6900">
Amount of sleeping between frames when the low-processor usage mode is enabled (in microseconds). Higher values will result in lower CPU usage.
Expand Down
10 changes: 10 additions & 0 deletions platform/android/os_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ void OS_Android::vibrate_handheld(int p_duration_ms) {
godot_java->vibrate(p_duration_ms);
}

void OS_Android::set_low_processor_usage_mode(bool p_enabled) {
if (p_enabled) {
WARN_PRINT("Low-processor usage mode is not supported on Android and iOS.");
}
}

bool OS_Android::is_in_low_processor_usage_mode() const {
return false;
}

bool OS_Android::_check_internal_feature_support(const String &p_feature) {
if (p_feature == "mobile") {
return true;
Expand Down
2 changes: 2 additions & 0 deletions platform/android/os_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class OS_Android : public OS_Unix {
virtual String get_system_dir(SystemDir p_dir) const;

void vibrate_handheld(int p_duration_ms);
virtual void set_low_processor_usage_mode(bool p_enabled);
virtual bool is_in_low_processor_usage_mode() const;

virtual bool _check_internal_feature_support(const String &p_feature);
OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_godot_io_java, bool p_use_apk_expansion);
Expand Down
2 changes: 2 additions & 0 deletions platform/iphone/os_iphone.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class OSIPhone : public OS_Unix {
virtual String get_unique_id() const override;

virtual void vibrate_handheld(int p_duration_ms = 500) override;
virtual void set_low_processor_usage_mode(bool p_enabled);
virtual bool is_in_low_processor_usage_mode() const;

virtual bool _check_internal_feature_support(const String &p_feature) override;

Expand Down
10 changes: 10 additions & 0 deletions platform/iphone/os_iphone.mm
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ void register_dynamic_symbol(char *name, void *address) {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}

void OSIPhone::set_low_processor_usage_mode(bool p_enabled) {
if (p_enabled) {
WARN_PRINT("Low-processor usage mode is not supported on Android and iOS.");
}
}

bool OSIPhone::is_in_low_processor_usage_mode() const {
return false;
}

bool OSIPhone::_check_internal_feature_support(const String &p_feature) {
return p_feature == "mobile";
}
Expand Down

0 comments on commit bf5d16e

Please sign in to comment.