summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-04 11:19:56 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-04 11:19:56 +0200
commit68765b8831a1fc56cf4d51ab2fdd844bfbcd9e97 (patch)
treea31d49269d5ab7cd249a3a12af244eb6acb0ffb9 /core
parent1c6e8f7e6236b0606342fb5bb415f53b366c0bc6 (diff)
parent1c6c72caf1b3cc004c3bcbe65b5bef5c850f82f8 (diff)
Merge pull request #66274 from Calinou/engine-rename-max-fps
Rename `Engine.target_fps` and associated project setting to `max_fps`
Diffstat (limited to 'core')
-rw-r--r--core/config/engine.cpp8
-rw-r--r--core/config/engine.h6
-rw-r--r--core/core_bind.cpp14
-rw-r--r--core/core_bind.h4
-rw-r--r--core/os/os.cpp6
5 files changed, 19 insertions, 19 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index cf9697be07..21e910be5b 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -59,12 +59,12 @@ double Engine::get_physics_jitter_fix() const {
return physics_jitter_fix;
}
-void Engine::set_target_fps(int p_fps) {
- _target_fps = p_fps > 0 ? p_fps : 0;
+void Engine::set_max_fps(int p_fps) {
+ _max_fps = p_fps > 0 ? p_fps : 0;
}
-int Engine::get_target_fps() const {
- return _target_fps;
+int Engine::get_max_fps() const {
+ return _max_fps;
}
uint64_t Engine::get_frames_drawn() {
diff --git a/core/config/engine.h b/core/config/engine.h
index 121fd4d541..21517e46b7 100644
--- a/core/config/engine.h
+++ b/core/config/engine.h
@@ -60,7 +60,7 @@ private:
int ips = 60;
double physics_jitter_fix = 0.5;
double _fps = 1;
- int _target_fps = 0;
+ int _max_fps = 0;
double _time_scale = 1.0;
uint64_t _physics_frames = 0;
double _physics_interpolation_fraction = 0.0f;
@@ -96,8 +96,8 @@ public:
void set_physics_jitter_fix(double p_threshold);
double get_physics_jitter_fix() const;
- virtual void set_target_fps(int p_fps);
- virtual int get_target_fps() const;
+ virtual void set_max_fps(int p_fps);
+ virtual int get_max_fps() const;
virtual double get_frames_per_second() const { return _fps; }
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 723217875d..7496ba1979 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -1483,12 +1483,12 @@ double Engine::get_physics_interpolation_fraction() const {
return ::Engine::get_singleton()->get_physics_interpolation_fraction();
}
-void Engine::set_target_fps(int p_fps) {
- ::Engine::get_singleton()->set_target_fps(p_fps);
+void Engine::set_max_fps(int p_fps) {
+ ::Engine::get_singleton()->set_max_fps(p_fps);
}
-int Engine::get_target_fps() const {
- return ::Engine::get_singleton()->get_target_fps();
+int Engine::get_max_fps() const {
+ return ::Engine::get_singleton()->get_max_fps();
}
double Engine::get_frames_per_second() const {
@@ -1625,8 +1625,8 @@ void Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_physics_jitter_fix", "physics_jitter_fix"), &Engine::set_physics_jitter_fix);
ClassDB::bind_method(D_METHOD("get_physics_jitter_fix"), &Engine::get_physics_jitter_fix);
ClassDB::bind_method(D_METHOD("get_physics_interpolation_fraction"), &Engine::get_physics_interpolation_fraction);
- ClassDB::bind_method(D_METHOD("set_target_fps", "target_fps"), &Engine::set_target_fps);
- ClassDB::bind_method(D_METHOD("get_target_fps"), &Engine::get_target_fps);
+ ClassDB::bind_method(D_METHOD("set_max_fps", "max_fps"), &Engine::set_max_fps);
+ ClassDB::bind_method(D_METHOD("get_max_fps"), &Engine::get_max_fps);
ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &Engine::set_time_scale);
ClassDB::bind_method(D_METHOD("get_time_scale"), &Engine::get_time_scale);
@@ -1669,7 +1669,7 @@ void Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "print_error_messages"), "set_print_error_messages", "is_printing_error_messages");
ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_ticks_per_second"), "set_physics_ticks_per_second", "get_physics_ticks_per_second");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "max_fps"), "set_max_fps", "get_max_fps");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_scale"), "set_time_scale", "get_time_scale");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
}
diff --git a/core/core_bind.h b/core/core_bind.h
index a63ed91137..9261698076 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -488,8 +488,8 @@ public:
double get_physics_jitter_fix() const;
double get_physics_interpolation_fraction() const;
- void set_target_fps(int p_fps);
- int get_target_fps() const;
+ void set_max_fps(int p_fps);
+ int get_max_fps() const;
double get_frames_per_second() const;
uint64_t get_physics_frames() const;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 2bdede889f..72d68893f3 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -511,10 +511,10 @@ void OS::add_frame_delay(bool p_can_draw) {
if (is_in_low_processor_usage_mode() || !p_can_draw) {
dynamic_delay = get_low_processor_usage_mode_sleep_usec();
}
- const int target_fps = Engine::get_singleton()->get_target_fps();
- if (target_fps > 0 && !Engine::get_singleton()->is_editor_hint()) {
+ const int max_fps = Engine::get_singleton()->get_max_fps();
+ if (max_fps > 0 && !Engine::get_singleton()->is_editor_hint()) {
// Override the low processor usage mode sleep delay if the target FPS is lower.
- dynamic_delay = MAX(dynamic_delay, (uint64_t)(1000000 / target_fps));
+ dynamic_delay = MAX(dynamic_delay, (uint64_t)(1000000 / max_fps));
}
if (dynamic_delay > 0) {