MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / frameLimitDropdown

Function frameLimitDropdown

src/OpenLoco/src/Ui/Windows/Options.cpp:416–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414 }
415
416 static void frameLimitDropdown(const Window& self, int16_t itemIndex)
417 {
418 if (itemIndex == -1)
419 {
420 return;
421 }
422
423 auto& config = Config::get();
424 switch (itemIndex)
425 {
426 case 0: // vanilla
427 config.uncapFPS = 0;
428 config.display.vsync = 0;
429 break;
430 case 1: // vsync
431 config.uncapFPS = 1;
432 config.display.vsync = 1;
433 break;
434 case 2: // uncapped
435 config.uncapFPS = 1;
436 config.display.vsync = 0;
437 break;
438 }
439
440 auto& drawingEngine = Gfx::getDrawingEngine();
441 if (drawingEngine.setVSync(config.display.vsync))
442 {
443 Config::write();
444 WindowManager::invalidateWidget(self.type, self.number, Widx::frame_limit);
445 }
446 }
447
448#pragma mark -
449

Callers 1

onDropdownFunction · 0.85

Calls 4

writeFunction · 0.85
invalidateWidgetFunction · 0.85
setVSyncMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected