mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-04-28 13:17:58 +03:00
Menu Header Button Reorder (#5134)
* Move close menu button to right side, farthest right, and move Quit SoH to the left of the Reset button. Also remove last reference to 2ship in tooltips. * Change Resolution Editor's use of CVarGet to `GetInterpolationFPS()` in OTRGlobals.
This commit is contained in:
parent
a95883b6b3
commit
63ae14cc30
3 changed files with 28 additions and 28 deletions
|
@ -581,22 +581,6 @@ void Menu::DrawElement() {
|
|||
headerHeight += style.ScrollbarSize;
|
||||
scrollbar = true;
|
||||
}
|
||||
UIWidgets::ButtonOptions options = {};
|
||||
options.size = UIWidgets::Sizes::Inline;
|
||||
options.tooltip = "Close Menu (Esc)";
|
||||
if (UIWidgets::Button(ICON_FA_TIMES_CIRCLE, options)) {
|
||||
ToggleVisibility();
|
||||
|
||||
// Update gamepad navigation after close based on if other menus are still visible
|
||||
auto mImGuiIo = &ImGui::GetIO();
|
||||
if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) &&
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) {
|
||||
mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
|
||||
} else {
|
||||
mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextWindowSizeConstraints({ 0, headerHeight }, { headerWidth, headerHeight });
|
||||
ImVec2 headerSelSize = { menuSize.x - buttonSize.x * 3 - style.ItemSpacing.x * 3, headerHeight };
|
||||
if (scrollbar) {
|
||||
|
@ -657,7 +641,19 @@ void Menu::DrawElement() {
|
|||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::SameLine(menuSize.x - (buttonSize.x * 2) - style.ItemSpacing.x);
|
||||
ImGui::SameLine(menuSize.x - (buttonSize.x * 3) - (style.ItemSpacing.x * 2));
|
||||
UIWidgets::ButtonOptions options3 = {};
|
||||
options3.color = UIWidgets::Colors::Red;
|
||||
options3.size = UIWidgets::Sizes::Inline;
|
||||
options3.tooltip = "Quit SoH";
|
||||
if (UIWidgets::Button(ICON_FA_POWER_OFF, options3)) {
|
||||
if (!popped) {
|
||||
ToggleVisibility();
|
||||
}
|
||||
Ship::Context::GetInstance()->GetWindow()->Close();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::SameLine();
|
||||
UIWidgets::ButtonOptions options2 = {};
|
||||
options2.color = UIWidgets::Colors::Red;
|
||||
options2.size = UIWidgets::Sizes::Inline;
|
||||
|
@ -676,17 +672,21 @@ void Menu::DrawElement() {
|
|||
->Dispatch("reset");
|
||||
}
|
||||
ImGui::SameLine();
|
||||
UIWidgets::ButtonOptions options3 = {};
|
||||
options3.color = UIWidgets::Colors::Red;
|
||||
options3.size = UIWidgets::Sizes::Inline;
|
||||
options3.tooltip = "Quit SoH";
|
||||
if (UIWidgets::Button(ICON_FA_POWER_OFF, options3)) {
|
||||
if (!popped) {
|
||||
ToggleVisibility();
|
||||
UIWidgets::ButtonOptions options = {};
|
||||
options.size = UIWidgets::Sizes::Inline;
|
||||
options.tooltip = "Close Menu (Esc)";
|
||||
if (UIWidgets::Button(ICON_FA_TIMES_CIRCLE, options)) {
|
||||
ToggleVisibility();
|
||||
|
||||
// Update gamepad navigation after close based on if other menus are still visible
|
||||
auto mImGuiIo = &ImGui::GetIO();
|
||||
if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) &&
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) {
|
||||
mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
|
||||
} else {
|
||||
mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
|
||||
}
|
||||
Ship::Context::GetInstance()->GetWindow()->Close();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
pos.y += headerHeight + style.ItemSpacing.y;
|
||||
pos.x = centerX - menuSize.x / 2 + (style.ItemSpacing.x * (menuEntries.size() + 1));
|
||||
|
|
|
@ -517,7 +517,7 @@ void UpdateResolutionVars() {
|
|||
bool IsDroppingFrames() {
|
||||
// a rather imprecise way of checking for frame drops.
|
||||
// but it's mostly there to inform the player of large drops.
|
||||
const short targetFPS = CVarGetInteger("gInterpolationFPS", 20);
|
||||
const short targetFPS = OTRGlobals::Instance->GetInterpolationFPS();
|
||||
const float threshold = targetFPS / 20.0f + 4.1f;
|
||||
return ImGui::GetIO().Framerate < targetFPS - threshold;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ void SohMenu::AddMenuSettings() {
|
|||
AddWidget(path, "Menu Controller Navigation", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_IMGUI_CONTROLLER_NAV)
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Allows controller navigation of the 2Ship menu (Settings, Enhancements,...)\nCAUTION: "
|
||||
"Allows controller navigation of the port menu (Settings, Enhancements,...)\nCAUTION: "
|
||||
"This will disable game inputs while the menu is visible.\n\nD-pad to move between "
|
||||
"items, A to select, B to move up in scope."));
|
||||
AddWidget(path, "Cursor Always Visible", WIDGET_CVAR_CHECKBOX)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue