From fa170b9ace1a2f45833627676b0106ee13914bd4 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 17 Feb 2021 15:31:09 +0100 Subject: Feature: configurable refresh-rate and change default to 60fps Most modern games run on 60 fps, and for good reason. This gives a much smoother experiences. As some people have monitors that can do 144Hz or even 240Hz, allow people to configure the refresh rate. Of course, the higher you set the value, the more time the game spends on drawing pixels instead of simulating the game, which has an effect on simulation speed. The simulation will still always run at 33.33 fps, and is not influences by this setting. --- src/video/allegro_v.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/video/allegro_v.cpp') diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 800cce40c..29db2f1da 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -485,20 +485,20 @@ void VideoDriver_Allegro::MainLoop() if (cur_ticks >= next_game_tick || (_fast_forward && !_pause_mode)) { if (_fast_forward && !_pause_mode) { - next_game_tick = cur_ticks + std::chrono::milliseconds(MILLISECONDS_PER_TICK); + next_game_tick = cur_ticks + this->GetGameInterval(); } else { - next_game_tick += std::chrono::milliseconds(MILLISECONDS_PER_TICK); + next_game_tick += this->GetGameInterval(); /* Avoid next_game_tick getting behind more and more if it cannot keep up. */ - if (next_game_tick < cur_ticks - std::chrono::milliseconds(ALLOWED_DRIFT * MILLISECONDS_PER_TICK)) next_game_tick = cur_ticks; + if (next_game_tick < cur_ticks - ALLOWED_DRIFT * this->GetGameInterval()) next_game_tick = cur_ticks; } GameLoop(); } if (cur_ticks >= next_draw_tick) { - next_draw_tick += std::chrono::milliseconds(MILLISECONDS_PER_TICK); + next_draw_tick += this->GetDrawInterval(); /* Avoid next_draw_tick getting behind more and more if it cannot keep up. */ - if (next_draw_tick < cur_ticks - std::chrono::microseconds(ALLOWED_DRIFT * MILLISECONDS_PER_TICK)) next_draw_tick = cur_ticks; + if (next_draw_tick < cur_ticks - ALLOWED_DRIFT * this->GetDrawInterval()) next_draw_tick = cur_ticks; bool old_ctrl_pressed = _ctrl_pressed; -- cgit v1.2.3-54-g00ecf