mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
impr: Default to monitor synchronized FPS limit
This commit is contained in:
@@ -435,6 +435,7 @@
|
||||
"hex.builtin.setting.interface.color": "Color theme",
|
||||
"hex.builtin.setting.interface.fps": "FPS Limit",
|
||||
"hex.builtin.setting.interface.fps.unlocked": "Unlocked",
|
||||
"hex.builtin.setting.interface.fps.native": "Native",
|
||||
"hex.builtin.setting.interface.language": "Language",
|
||||
"hex.builtin.setting.interface.multi_windows": "Enable Multi Window support",
|
||||
"hex.builtin.setting.interface.pattern_tree_style": "Pattern Tree Style",
|
||||
|
||||
@@ -223,9 +223,16 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.fps", 60, [](auto name, nlohmann::json &setting) {
|
||||
static int fps = static_cast<int>(setting);
|
||||
|
||||
auto format = fps > 200 ? "hex.builtin.setting.interface.fps.unlocked"_lang : "%d FPS";
|
||||
auto format = [] -> std::string {
|
||||
if (fps > 200)
|
||||
return "hex.builtin.setting.interface.fps.unlocked"_lang;
|
||||
else if (fps < 15)
|
||||
return "hex.builtin.setting.interface.fps.native"_lang;
|
||||
else
|
||||
return "%d FPS";
|
||||
}();
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &fps, 15, 201, format, ImGuiSliderFlags_AlwaysClamp)) {
|
||||
if (ImGui::SliderInt(name.data(), &fps, 14, 201, format.c_str(), ImGuiSliderFlags_AlwaysClamp)) {
|
||||
setting = fps;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
{
|
||||
auto targetFps = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.fps", 60);
|
||||
auto targetFps = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.fps", 14);
|
||||
|
||||
ImHexApi::System::setTargetFPS(targetFps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user