summaryrefslogtreecommitdiff
path: root/core/engine.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-05-07 19:27:32 -0300
committerGitHub <noreply@github.com>2018-05-07 19:27:32 -0300
commit633bbdb2318a9776b651264ea6146bd805a16fb8 (patch)
tree812348e4be2f405683a710eafdb2c06cd852996f /core/engine.cpp
parent9f2d54cd6827e39799b85bf306d0fc98ce5941bd (diff)
parentd5abd4eb750387c95d1040e7613f98bd816c58bb (diff)
Merge pull request #17353 from zmanuel/timer_hysteresis_multiframe_pr1
Use hysteresis for smoother physics update frequency
Diffstat (limited to 'core/engine.cpp')
-rw-r--r--core/engine.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/engine.cpp b/core/engine.cpp
index af9052110f..b2c34a853c 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -42,6 +42,16 @@ int Engine::get_iterations_per_second() const {
return ips;
}
+void Engine::set_physics_jitter_fix(float p_threshold) {
+ if (p_threshold < 0)
+ p_threshold = 0;
+ physics_jitter_fix = p_threshold;
+}
+
+float 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;
}
@@ -137,6 +147,7 @@ Engine::Engine() {
singleton = this;
frames_drawn = 0;
ips = 60;
+ physics_jitter_fix = 0.5;
_frame_delay = 0;
_fps = 1;
_target_fps = 0;