Skip to content

Commit 131e90c

Browse files
authored
Respect the configured FPS limit in menus (#1000)
1 parent be3a335 commit 131e90c

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎common/mainwindow.cpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,13 +1276,11 @@ void MainWindow::render(){
12761276
cmdId = (cmdId+1u)%Resources::MaxFramesInFlight;
12771277

12781278
auto t = Application::tickCount();
1279-
if(t-time<16 && !Gothic::inst().isInGame() && !video.isActive()) {
1280-
uint32_t delay = uint32_t(16-(t-time));
1281-
Application::sleep(delay);
1282-
t += delay;
1283-
}
1284-
else if(maxFpsInv>0 && t-time<maxFpsInv) {
1285-
uint32_t delay = uint32_t(maxFpsInv-(t-time));
1279+
auto frameTime = maxFpsInv;
1280+
if(!Gothic::inst().isInGame() && !video.isActive())
1281+
frameTime = std::max<uint64_t>(frameTime,16);
1282+
if(t-time<frameTime) {
1283+
uint32_t delay = uint32_t(frameTime-(t-time));
12861284
Application::sleep(delay);
12871285
t += delay;
12881286
}

0 commit comments

Comments
 (0)