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/video_driver.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/video/video_driver.hpp') diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index 94803db22..732050c76 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -13,7 +13,9 @@ #include "../driver.h" #include "../core/geometry_type.hpp" #include "../core/math_func.hpp" +#include "../settings_type.h" #include "../zoom_type.h" +#include #include extern std::string _ini_videodriver; @@ -153,6 +155,16 @@ protected: _cur_resolution.height = ClampU(res.height * 3 / 4, DEFAULT_WINDOW_HEIGHT, UINT16_MAX / 2); } } + + std::chrono::steady_clock::duration GetGameInterval() + { + return std::chrono::milliseconds(MILLISECONDS_PER_TICK); + } + + std::chrono::steady_clock::duration GetDrawInterval() + { + return std::chrono::microseconds(1000000 / _settings_client.gui.refresh_rate); + } }; #endif /* VIDEO_VIDEO_DRIVER_HPP */ -- cgit v1.2.3-54-g00ecf