1
0
mirror of synced 2025-02-17 18:59:21 +01:00

ui: Increased maximum FPS limit to 200FPS, added unlocked FPS setting

Closes #329
This commit is contained in:
WerWolv 2021-10-23 12:59:13 +02:00
parent d9a77d396c
commit c95e12c136
6 changed files with 10 additions and 2 deletions

View File

@ -123,7 +123,9 @@ 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);
if (ImGui::SliderInt(name.data(), &fps, 15, 60)) {
auto format = fps > 200 ? "hex.builtin.setting.interface.fps.unlocked"_lang : "%d FPS";
if (ImGui::SliderInt(name.data(), &fps, 15, 201, format, ImGuiSliderFlags_AlwaysClamp)) {
setting = fps;
return true;
}

View File

@ -646,6 +646,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.scaling.x2_0", "x2.0" },
{ "hex.builtin.setting.interface.language", "Sprache" },
{ "hex.builtin.setting.interface.fps", "FPS Limite" },
{ "hex.builtin.setting.interface.fps.unlocked", "Unbegrenzt" },
{ "hex.builtin.setting.interface.highlight_alpha", "Markierungssichtbarkeit" },
{ "hex.builtin.setting.hex_editor", "Hex Editor" },
{ "hex.builtin.setting.hex_editor.column_count", "Anzahl Byte Spalten" },

View File

@ -647,6 +647,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.scaling.x2_0", "x2.0" },
{ "hex.builtin.setting.interface.language", "Language" },
{ "hex.builtin.setting.interface.fps", "FPS Limit" },
{ "hex.builtin.setting.interface.fps.unlocked", "Unlocked" },
{ "hex.builtin.setting.interface.highlight_alpha", "Highlighting opacity" },
{ "hex.builtin.setting.hex_editor", "Hex Editor" },
{ "hex.builtin.setting.hex_editor.column_count", "Byte column count" },

View File

@ -645,6 +645,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.scaling.x1_5", "x1.5" },
{ "hex.builtin.setting.interface.scaling.x2_0", "x2.0" },
{ "hex.builtin.setting.interface.fps", "Limite FPS" },
//{ "hex.builtin.setting.interface.fps.unlocked", "Unlocked" },
{ "hex.builtin.setting.interface.highlight_alpha", "Evidenziazione dell'opacità" },
//{ "hex.builtin.setting.hex_editor", "Hex Editor" },
//{ "hex.builtin.setting.hex_editor.column_count", "Byte column count" },

View File

@ -647,6 +647,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.scaling.x2_0", "x2.0" },
{ "hex.builtin.setting.interface.language", "语言" },
{ "hex.builtin.setting.interface.fps", "FPS限制" },
//{ "hex.builtin.setting.interface.fps.unlocked", "Unlocked" },
{ "hex.builtin.setting.interface.highlight_alpha", "高亮不透明度" },
{ "hex.builtin.setting.hex_editor", "Hex编辑器" },
{ "hex.builtin.setting.hex_editor.column_count", "字节列数" },

View File

@ -521,7 +521,9 @@ namespace hex {
glfwSwapBuffers(this->m_window);
std::this_thread::sleep_for(std::chrono::milliseconds(u64((this->m_lastFrameTime + 1 / this->m_targetFps - glfwGetTime()) * 1000)));
if (this->m_targetFps <= 200)
std::this_thread::sleep_for(std::chrono::milliseconds(u64((this->m_lastFrameTime + 1 / this->m_targetFps - glfwGetTime()) * 1000)));
this->m_lastFrameTime = glfwGetTime();
}