mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
Further Menu Improvements (#5129)
* Menu improvements * Update calc for button offsets * Fix enemy rando UI
This commit is contained in:
parent
9e883ece96
commit
ab5ea0e8ee
17 changed files with 100 additions and 220 deletions
|
@ -428,7 +428,6 @@ InputViewerSettingsWindow::~InputViewerSettingsWindow() {
|
|||
}
|
||||
|
||||
void InputViewerSettingsWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
|
||||
// gInputViewer.Scale
|
||||
CVarSliderFloat("Input Viewer Scale: %.2f", CVAR_INPUT_VIEWER("Scale"),
|
||||
FloatSliderOptions().Color(THEME_COLOR).DefaultValue(1.0f).Min(0.1f).Max(5.0f).ShowButtons(true).Tooltip("Sets the on screen size of the input viewer"));
|
||||
|
@ -640,5 +639,4 @@ void InputViewerSettingsWindow::DrawElement() {
|
|||
}
|
||||
}
|
||||
PopStyleHeader();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
|
|
@ -1523,7 +1523,7 @@ void Draw_Placements(){
|
|||
CVarSetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Changed"), 1);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 24);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::CalcTextSize("g").y * 2));
|
||||
if (UIWidgets::Button("Reset##EnemyHealthBarWidth",
|
||||
UIWidgets::ButtonOptions().Size(ImVec2(80, 36)).Padding(ImVec2(5.0f, 0.0f)))) {
|
||||
CVarClear(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Value"));
|
||||
|
@ -1537,7 +1537,7 @@ void Draw_Placements(){
|
|||
|
||||
void Reset_Option_Single(const char* Button_Title, const char* name) {
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 24);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::CalcTextSize("g").y * 2));
|
||||
if (UIWidgets::Button(Button_Title,
|
||||
UIWidgets::ButtonOptions().Size(ImVec2(80, 36)).Padding(ImVec2(5.0f, 0.0f)))) {
|
||||
CVarClear(name);
|
||||
|
@ -1546,7 +1546,7 @@ void Reset_Option_Single(const char* Button_Title, const char* name) {
|
|||
|
||||
void Reset_Option_Double(const char* Button_Title, const char* name) {
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 24);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::CalcTextSize("g").y * 2));
|
||||
if (UIWidgets::Button(Button_Title,
|
||||
UIWidgets::ButtonOptions().Size(ImVec2(80, 36)).Padding(ImVec2(5.0f, 0.0f)))) {
|
||||
CVarClear((std::string(name) + ".Value").c_str());
|
||||
|
@ -1578,7 +1578,7 @@ void DrawSillyTab() {
|
|||
CVarSetInteger(CVAR_COSMETIC("Link.BodySize.Changed"), 1);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 24);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::CalcTextSize("g").y * 2));
|
||||
if (UIWidgets::Button("Reset##Link_BodySize",
|
||||
UIWidgets::ButtonOptions().Size(ImVec2(80, 36)).Padding(ImVec2(5.0f, 0.0f)))) {
|
||||
CVarClear(CVAR_COSMETIC("Link.BodySize.Value"));
|
||||
|
@ -2194,7 +2194,7 @@ void CosmeticsEditorWindow::DrawElement() {
|
|||
CVarSetInteger(CVAR_COSMETIC("Trails.Duration.Changed"), 1);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 24);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::CalcTextSize("g").y * 2));
|
||||
if (UIWidgets::Button("Reset##Trails_Duration", UIWidgets::ButtonOptions()
|
||||
.Size(ImVec2(80, 36))
|
||||
.Padding(ImVec2(5.0f, 0.0f)))) {
|
||||
|
|
|
@ -26,7 +26,6 @@ void MessageViewer::InitElement() {
|
|||
}
|
||||
|
||||
void MessageViewer::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest);
|
||||
ImGui::Text("Table ID");
|
||||
ImGui::SameLine();
|
||||
PushStyleInput(THEME_COLOR);
|
||||
|
@ -86,7 +85,6 @@ void MessageViewer::DrawElement() {
|
|||
mDisplayCustomMessageClicked = true;
|
||||
}
|
||||
PopStyleButton();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void MessageViewer::UpdateElement() {
|
||||
|
|
|
@ -934,8 +934,6 @@ void ActorViewerWindow::DrawElement() {
|
|||
static s16 currentSelectedInDropdown;
|
||||
static std::vector<u16> actors;
|
||||
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest);
|
||||
|
||||
if (gPlayState != nullptr) {
|
||||
needs_reset = lastSceneId != gPlayState->sceneNum;
|
||||
if (needs_reset) {
|
||||
|
@ -1234,7 +1232,6 @@ void ActorViewerWindow::DrawElement() {
|
|||
actors.clear();
|
||||
}
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void ActorViewerWindow::InitElement() {
|
||||
|
|
|
@ -91,7 +91,6 @@ void PerformDisplayListSearch() {
|
|||
}
|
||||
|
||||
void DLViewerWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
|
||||
// Debounce the search field as listing otr files is expensive
|
||||
UIWidgets::PushStyleInput(THEME_COLOR);
|
||||
if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) {
|
||||
|
@ -122,7 +121,6 @@ void DLViewerWindow::DrawElement() {
|
|||
UIWidgets::PopStyleCombobox();
|
||||
|
||||
if (activeDisplayList == "") {
|
||||
ImGui::PopFont();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -131,7 +129,6 @@ void DLViewerWindow::DrawElement() {
|
|||
|
||||
if (res->GetInitData()->Type != static_cast<uint32_t>(Fast::ResourceType::DisplayList)) {
|
||||
ImGui::Text("Resource type is not a Display List. Please choose another.");
|
||||
ImGui::PopFont();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -329,10 +326,8 @@ void DLViewerWindow::DrawElement() {
|
|||
}
|
||||
} catch (const std::exception& e) {
|
||||
ImGui::Text("Error displaying DL instructions.");
|
||||
ImGui::PopFont();
|
||||
return;
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void DLViewerWindow::InitElement() {
|
||||
|
|
|
@ -143,7 +143,6 @@ void RegisterValueViewerHooks() {
|
|||
RegisterShipInitFunc initFunc(RegisterValueViewerHooks, { CVAR_NAME });
|
||||
|
||||
void ValueViewerWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest);
|
||||
UIWidgets::CVarCheckbox("Enable Printing", CVAR_NAME, UIWidgets::CheckboxOptions().Color(THEME_COLOR));
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
@ -264,7 +263,6 @@ void ValueViewerWindow::DrawElement() {
|
|||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void ValueViewerWindow::InitElement() {
|
||||
|
|
|
@ -286,7 +286,7 @@ void GetSelectedEnemies() {
|
|||
for (int i = 0; i < 49; i++) {
|
||||
if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemyList.All"), 0)) {
|
||||
selectedEnemyList.push_back(randomizedEnemySpawnTable[i]);
|
||||
} else if (CVarGetInteger(enemyCVarList[i], 0)) {
|
||||
} else if (CVarGetInteger(enemyCVarList[i], 1)) {
|
||||
selectedEnemyList.push_back(randomizedEnemySpawnTable[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1141,14 +1141,12 @@ void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flag
|
|||
Color_Background.b / 255.0f, Color_Background.a / 255.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
|
||||
ImGui::Begin(UniqueName.c_str(), &open, windowFlags);
|
||||
}
|
||||
void EndFloatWindows() {
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopFont();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
@ -1760,7 +1758,6 @@ static std::unordered_map<int32_t, const char*> buttonStrings = {
|
|||
{ TRACKER_COMBO_BUTTON_D_LEFT, "D-Left" }, { TRACKER_COMBO_BUTTON_D_RIGHT, "D-Right" }};
|
||||
|
||||
void CheckTrackerSettingsWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
|
||||
if (ImGui::BeginTable("CheckTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {
|
||||
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
|
@ -1827,7 +1824,6 @@ void CheckTrackerSettingsWindow::DrawElement() {
|
|||
ImGui::PopStyleVar(1);
|
||||
}
|
||||
ImGui::EndTable();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void CheckTrackerWindow::InitElement() {
|
||||
|
|
|
@ -660,7 +660,6 @@ void InitEntranceTrackingData() {
|
|||
|
||||
void EntranceTrackerSettingsWindow::DrawElement() {
|
||||
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
|
||||
ImGui::TextWrapped("The entrance tracker will only track shuffled entrances");
|
||||
UIWidgets::Spacer(0);
|
||||
|
||||
|
@ -722,7 +721,6 @@ void EntranceTrackerSettingsWindow::DrawElement() {
|
|||
ImGui::TextColored(ImColor(COLOR_GRAY), "Undiscovered Entrances");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void EntranceTrackerWindow::Draw() {
|
||||
|
@ -735,12 +733,10 @@ void EntranceTrackerWindow::Draw() {
|
|||
}
|
||||
|
||||
void EntranceTrackerWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
|
||||
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
|
||||
|
||||
if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||
ImGui::End();
|
||||
ImGui::PopFont();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -938,7 +934,6 @@ void EntranceTrackerWindow::DrawElement() {
|
|||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void EntranceTrackerWindow::InitElement() {
|
||||
|
|
|
@ -469,6 +469,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
|
|||
if (!GameInteractor::IsSaveLoaded()) {
|
||||
return;
|
||||
}
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMono);
|
||||
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
|
||||
int textSize = CVarGetInteger(CVAR_TRACKER_ITEM("TextSize"), 13);
|
||||
ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item);
|
||||
|
@ -611,6 +612,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
|
|||
ImGui::SetCursorScreenPos(ImVec2(p.x, p.y - 14));
|
||||
ImGui::Text("");
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void DrawEquip(ItemTrackerItem item) {
|
||||
|
@ -952,14 +954,12 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
|
|||
ImGui::PushStyleColor(ImGuiCol_WindowBg, VecFromRGBA8(CVarGetColor(CVAR_TRACKER_ITEM("BgColor.Value"), {0, 0, 0, 0})));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
|
||||
ImGui::Begin(UniqueName.c_str(), nullptr, windowFlags);
|
||||
}
|
||||
void EndFloatingWindows() {
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopFont();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
@ -1375,7 +1375,6 @@ static std::unordered_map<int32_t, const char*> extendedDisplayTypes = {{ SECTIO
|
|||
static std::unordered_map<int32_t, const char*> minimalDisplayTypes = {{ SECTION_DISPLAY_MINIMAL_HIDDEN, "Hidden" }, { SECTION_DISPLAY_MINIMAL_SEPARATE, "Separate" }};
|
||||
|
||||
void ItemTrackerSettingsWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
|
||||
ImGui::BeginTable("itemTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
|
||||
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
|
@ -1541,7 +1540,6 @@ void ItemTrackerSettingsWindow::DrawElement() {
|
|||
|
||||
ImGui::PopStyleVar(1);
|
||||
ImGui::EndTable();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void ItemTrackerWindow::InitElement() {
|
||||
|
|
|
@ -941,7 +941,6 @@ static bool initialized = false;
|
|||
|
||||
void TimeSplitWindow::DrawElement() {
|
||||
ImGui::SetWindowFontScale(timeSplitsWindowSize);
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest);
|
||||
|
||||
PushStyleTabs(THEME_COLOR);
|
||||
if (ImGui::BeginTabBar("Split Tabs")) {
|
||||
|
@ -960,7 +959,6 @@ void TimeSplitWindow::DrawElement() {
|
|||
ImGui::EndTabBar();
|
||||
}
|
||||
PopStyleTabs();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void TimeSplitWindow::InitElement() {
|
||||
|
|
|
@ -407,7 +407,7 @@ OTRGlobals::OTRGlobals() {
|
|||
fontStandard = CreateFontWithSize(16.0f, "fonts/Montserrat-Regular.ttf");
|
||||
fontStandardLarger = CreateFontWithSize(20.0f, "fonts/Montserrat-Regular.ttf");
|
||||
fontStandardLargest = CreateFontWithSize(24.0f, "fonts/Montserrat-Regular.ttf");
|
||||
ImGui::GetIO().FontDefault = fontMono;
|
||||
ImGui::GetIO().FontDefault = fontStandardLarger;
|
||||
ScaleImGui();
|
||||
|
||||
// Move the camera strings from read only memory onto the heap (writable memory)
|
||||
|
|
|
@ -530,13 +530,13 @@ void Menu::DrawElement() {
|
|||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLargest);
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
windowHeight = window->WorkRect.GetHeight();
|
||||
windowWidth = window->WorkRect.GetWidth();
|
||||
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontStandardLargest);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10.0f, 8.0f));
|
||||
const char* headerCvar = CVAR_SETTING("Menu.ActiveHeader");
|
||||
std::string headerIndex = CVarGetString(headerCvar, "Settings");
|
||||
|
@ -559,12 +559,13 @@ void Menu::DrawElement() {
|
|||
|
||||
// Full screen menu with widths below 1280, heights below 800.
|
||||
// 5% of screen width/height padding on both sides above those resolutions.
|
||||
ImVec2 menuSize = { std::fminf(1280, windowWidth), std::fminf(800, windowHeight) };
|
||||
// Menu width will never exceed a 16:9 aspect ratio.
|
||||
ImVec2 menuSize = { windowWidth, windowHeight };
|
||||
if (windowWidth > 1280) {
|
||||
menuSize.x = floor(windowWidth * 0.9);
|
||||
menuSize.x = std::fminf(windowWidth * 0.9f, (windowHeight * 1.77f));
|
||||
}
|
||||
if (windowHeight > 800) {
|
||||
menuSize.y = floor(windowHeight * 0.9);
|
||||
menuSize.y = windowHeight * 0.9f;
|
||||
}
|
||||
|
||||
pos += window->WorkRect.GetSize() / 2 - menuSize / 2;
|
||||
|
@ -696,7 +697,12 @@ void Menu::DrawElement() {
|
|||
float sectionHeight = menuSize.y - headerHeight - 4 - style.ItemSpacing.y * 2;
|
||||
float columnHeight = sectionHeight - style.ItemSpacing.y * 4;
|
||||
ImGui::SetNextWindowPos(pos + style.ItemSpacing * 2);
|
||||
|
||||
// Increase sidebar width on larger screens to accomodate people scaling their menus.
|
||||
float sidebarWidth = 200 - style.ItemSpacing.x;
|
||||
if (menuSize.x > 1600) {
|
||||
sidebarWidth = menuSize.x * 0.15f;
|
||||
}
|
||||
|
||||
const char* sidebarCvar = menuEntries.at(headerIndex).sidebarCvar;
|
||||
|
||||
|
@ -732,8 +738,8 @@ void Menu::DrawElement() {
|
|||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
|
||||
pos = ImVec2{ sectionCenterX + (sidebarWidth / 2), topY } + style.ItemSpacing * 2;
|
||||
window->DrawList->AddRectFilled(pos, pos + ImVec2{ 4, sectionHeight - style.FramePadding.y * 2 },
|
||||
ImGui::GetColorU32({ 255, 255, 255, 255 }), true, style.WindowRounding);
|
||||
|
@ -802,8 +808,6 @@ void Menu::DrawElement() {
|
|||
if (!useColumns || menuSearchText.length() > 0) {
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::PopFont();
|
||||
ImGui::PopFont();
|
||||
|
||||
if (!popout) {
|
||||
ImGui::PopStyleVar();
|
||||
|
|
|
@ -34,7 +34,8 @@ void SohMenu::AddMenuEnhancements() {
|
|||
if (iter->first != 0) comboboxTooltip += "\n\n";
|
||||
comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description);
|
||||
}
|
||||
AddWidget(path, "Enhancement Presets", WIDGET_COMBOBOX)
|
||||
AddWidget(path, "Enhancement Presets", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Select Preset", WIDGET_COMBOBOX)
|
||||
.ValuePointer(&enhancementPresetSelected)
|
||||
.Callback([](WidgetInfo& info) {
|
||||
const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_ENHANCEMENTS);
|
||||
|
@ -46,6 +47,7 @@ void SohMenu::AddMenuEnhancements() {
|
|||
.Tooltip(comboboxTooltip.c_str())
|
||||
);
|
||||
AddWidget(path, "Apply Preset##Enhancemnts", WIDGET_BUTTON)
|
||||
.Options(ButtonOptions().Size(UIWidgets::Sizes::Inline))
|
||||
.Callback([](WidgetInfo& info) {
|
||||
const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_ENHANCEMENTS);
|
||||
const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_ENHANCEMENTS);
|
||||
|
@ -1051,7 +1053,7 @@ void SohMenu::AddMenuEnhancements() {
|
|||
));
|
||||
|
||||
path.sidebarName = "Items";
|
||||
AddSidebarEntry("Enhancements", path.sidebarName, 2);
|
||||
AddSidebarEntry("Enhancements", path.sidebarName, 3);
|
||||
path.column = SECTION_COLUMN_1;
|
||||
|
||||
AddWidget(path, "Controls", WIDGET_SEPARATOR_TEXT);
|
||||
|
@ -1678,7 +1680,7 @@ void SohMenu::AddMenuEnhancements() {
|
|||
);
|
||||
|
||||
path.sidebarName = "Extra Modes";
|
||||
AddSidebarEntry("Enhancements", path.sidebarName, 2);
|
||||
AddSidebarEntry("Enhancements", path.sidebarName, 3);
|
||||
path.column = SECTION_COLUMN_1;
|
||||
|
||||
AddWidget(path, "Mirrored World", WIDGET_CVAR_COMBOBOX)
|
||||
|
@ -1703,19 +1705,6 @@ void SohMenu::AddMenuEnhancements() {
|
|||
" - Dungeons Random (Seeded): Dungeons are mirrored based on the current randomizer seed/file\n"
|
||||
)
|
||||
);
|
||||
AddWidget(path, "Randomized Enemy Sizes", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("RandomizedEnemySizes"))
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Enemies and Bosses spawn with random sizes."
|
||||
));
|
||||
AddWidget(path, "Scale Health with Size", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("EnemySizeScalesHealth"))
|
||||
.PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemySizes"), 0) == 0;
|
||||
})
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Scales normal enemies Health with their randomized size. *This will NOT affect bosses*"
|
||||
));
|
||||
AddWidget(path, "Ivan the Fairy (Coop Mode)", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("IvanCoopModeEnabled"))
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
|
@ -1827,6 +1816,7 @@ void SohMenu::AddMenuEnhancements() {
|
|||
.PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = CVarGetInteger(CVAR_ENHANCEMENT("ExtraTraps.Enabled"), 0) == 0;
|
||||
});
|
||||
|
||||
path.column = SECTION_COLUMN_2;
|
||||
AddWidget(path, "Enemy Randomizer", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("RandomizedEnemies"))
|
||||
|
@ -1843,22 +1833,34 @@ void SohMenu::AddMenuEnhancements() {
|
|||
"- Random (Seeded): Enemies are randomized based on the current randomizer seed/file\n"
|
||||
)
|
||||
);
|
||||
AddWidget(path, "Randomized Enemy Sizes", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("RandomizedEnemySizes"))
|
||||
.Options(CheckboxOptions().Tooltip("Enemies and Bosses spawn with random sizes."));
|
||||
AddWidget(path, "Scale Health with Size", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("EnemySizeScalesHealth"))
|
||||
.PreFunc(
|
||||
[](WidgetInfo& info) { info.options->disabled = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemySizes"), 0); })
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Scales normal enemies Health with their randomized size. *This will NOT affect bosses*"));
|
||||
AddWidget(path, "Enemy List", WIDGET_SEPARATOR_TEXT)
|
||||
.PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) != ENEMY_RANDOMIZER_RANDOM;
|
||||
info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0);
|
||||
});
|
||||
AddWidget(path, "Select All Enemies", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("RandomizedEnemyList.All"))
|
||||
.PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) != ENEMY_RANDOMIZER_RANDOM;
|
||||
info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0);
|
||||
});
|
||||
AddWidget(path, "Enemy List", WIDGET_SEPARATOR).PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0);
|
||||
});
|
||||
AddWidget(path, "Enemy List", WIDGET_SEPARATOR);
|
||||
for (int i = 0; i < RANDOMIZED_ENEMY_SPAWN_TABLE_SIZE; i++) {
|
||||
AddWidget(path, enemyNameList[i], WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(enemyCVarList[i])
|
||||
.Options(CheckboxOptions().DefaultValue(true))
|
||||
.PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) != ENEMY_RANDOMIZER_RANDOM;
|
||||
info.options->disabled = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemyList.All"), 0) == 1;
|
||||
info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0);
|
||||
info.options->disabled = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemyList.All"), 0);
|
||||
info.options->disabledTooltip = "These options are disabled because \"Select All Enemies\" is enabled.";
|
||||
})
|
||||
.Callback([](WidgetInfo& info) {
|
||||
|
@ -1871,6 +1873,14 @@ void SohMenu::AddMenuEnhancements() {
|
|||
AddSidebarEntry("Enhancements", path.sidebarName, 3);
|
||||
path.column = SECTION_COLUMN_1;
|
||||
|
||||
AddWidget(path, "Infinite...", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Money", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteMoney"));
|
||||
AddWidget(path, "Health", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteHealth"));
|
||||
AddWidget(path, "Ammo", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteAmmo"));
|
||||
AddWidget(path, "Magic", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteMagic"));
|
||||
AddWidget(path, "Nayru's Love", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteNayru"));
|
||||
AddWidget(path, "Epona Boost", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteEponaBoost"));
|
||||
|
||||
AddWidget(path, "Inventory", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Super Tunic", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_CHEAT("SuperTunic"))
|
||||
|
@ -1909,73 +1919,8 @@ void SohMenu::AddMenuEnhancements() {
|
|||
.Options(CheckboxOptions().Tooltip(
|
||||
"This allows you to put up for shield with any two-handed weapon in hand except for Deku Sticks."
|
||||
));
|
||||
AddWidget(path, "Deku Sticks:", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_CHEAT("DekuStick"))
|
||||
.Options(ComboboxOptions().ComboMap(
|
||||
dekuStickCheat
|
||||
).DefaultIndex(DEKU_STICK_NORMAL));
|
||||
AddWidget(path, "Bomb Timer Multiplier: %.2fx", WIDGET_CVAR_SLIDER_FLOAT)
|
||||
.CVar(CVAR_CHEAT("BombTimerMultiplier"))
|
||||
.Options(FloatSliderOptions()
|
||||
.Format("%.2f")
|
||||
.Min(0.1f)
|
||||
.Max(5.0f)
|
||||
.DefaultValue(1.0f));
|
||||
AddWidget(path, "Hookshot Everything", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_CHEAT("HookshotEverything"))
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Makes every surface in the game hookshot-able."
|
||||
));
|
||||
AddWidget(path, "Hookshot Reach Multiplier: %.2fx", WIDGET_CVAR_SLIDER_FLOAT)
|
||||
.CVar(CVAR_CHEAT("HookshotReachMultiplier"))
|
||||
.Options(FloatSliderOptions()
|
||||
.Format("%.2f")
|
||||
.Min(1.0f)
|
||||
.Max(5.0f));
|
||||
AddWidget(path, "Change Age", WIDGET_BUTTON)
|
||||
.Options(ButtonOptions().Tooltip("Switches Link's age and reloads the area."))
|
||||
.Callback([](WidgetInfo& info){
|
||||
SwitchAge();
|
||||
});
|
||||
AddWidget(path, "Clear Cutscene Pointer", WIDGET_BUTTON)
|
||||
.Callback([](WidgetInfo& info) {
|
||||
GameInteractor::RawAction::ClearCutscenePointer();
|
||||
})
|
||||
.Options(ButtonOptions().Tooltip(
|
||||
"Clears the cutscene pointer to a value safe for wrong warps."
|
||||
));
|
||||
|
||||
path.column = SECTION_COLUMN_2;
|
||||
AddWidget(path, "Infinite...", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Money", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteMoney"));
|
||||
AddWidget(path, "Health", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteHealth"));
|
||||
AddWidget(path, "Ammo", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteAmmo"));
|
||||
AddWidget(path, "Magic", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteMagic"));
|
||||
AddWidget(path, "Nayru's Love", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteNayru"));
|
||||
AddWidget(path, "Epona Boost", WIDGET_CVAR_CHECKBOX).CVar(CVAR_CHEAT("InfiniteEponaBoost"));
|
||||
|
||||
AddWidget(path, "Save States", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, ICON_FA_EXCLAMATION_TRIANGLE " WARNING!!!! " ICON_FA_EXCLAMATION_TRIANGLE, WIDGET_TEXT)
|
||||
.Options(WidgetOptions().Color(Colors::Orange));
|
||||
AddWidget(path,
|
||||
"These are NOT like emulator states. They do not save your game progress "
|
||||
"and they WILL break across transitions and load zones (like doors). "
|
||||
"Support for related issues will not be provided.", WIDGET_TEXT
|
||||
);
|
||||
AddWidget(path, "I promise I have read the warning", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_CHEAT("SaveStatePromise"))
|
||||
.Callback([](WidgetInfo& info) {
|
||||
CVarSetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0);
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||
});
|
||||
AddWidget(path, "I understand, enable save states", WIDGET_CVAR_CHECKBOX)
|
||||
.PreFunc([](WidgetInfo& info) {
|
||||
info.isHidden = CVarGetInteger(CVAR_CHEAT("SaveStatePromise"), 0) == 0;
|
||||
})
|
||||
.CVar(CVAR_CHEAT("SaveStatesEnabled"))
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"F5 to save, F6 to change slots, F7 to load"
|
||||
));
|
||||
|
||||
AddWidget(path, "Behavior", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "No Clip", WIDGET_CVAR_CHECKBOX)
|
||||
|
@ -2024,7 +1969,46 @@ void SohMenu::AddMenuEnhancements() {
|
|||
"Keese and Guay no longer target you and simply ignore you as if you were wearing the "
|
||||
"Skull Mask."
|
||||
));
|
||||
|
||||
AddWidget(path, "Deku Sticks:", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_CHEAT("DekuStick"))
|
||||
.Options(ComboboxOptions().ComboMap(dekuStickCheat).DefaultIndex(DEKU_STICK_NORMAL));
|
||||
AddWidget(path, "Bomb Timer Multiplier: %.2fx", WIDGET_CVAR_SLIDER_FLOAT)
|
||||
.CVar(CVAR_CHEAT("BombTimerMultiplier"))
|
||||
.Options(FloatSliderOptions().Format("%.2f").Min(0.1f).Max(5.0f).DefaultValue(1.0f));
|
||||
AddWidget(path, "Hookshot Everything", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_CHEAT("HookshotEverything"))
|
||||
.Options(CheckboxOptions().Tooltip("Makes every surface in the game hookshot-able."));
|
||||
AddWidget(path, "Hookshot Reach Multiplier: %.2fx", WIDGET_CVAR_SLIDER_FLOAT)
|
||||
.CVar(CVAR_CHEAT("HookshotReachMultiplier"))
|
||||
.Options(FloatSliderOptions().Format("%.2f").Min(1.0f).Max(5.0f));
|
||||
AddWidget(path, "Change Age", WIDGET_BUTTON)
|
||||
.Options(ButtonOptions().Tooltip("Switches Link's age and reloads the area."))
|
||||
.Callback([](WidgetInfo& info) { SwitchAge(); });
|
||||
AddWidget(path, "Clear Cutscene Pointer", WIDGET_BUTTON)
|
||||
.Callback([](WidgetInfo& info) { GameInteractor::RawAction::ClearCutscenePointer(); })
|
||||
.Options(ButtonOptions().Tooltip("Clears the cutscene pointer to a value safe for wrong warps."));
|
||||
|
||||
path.column = SECTION_COLUMN_3;
|
||||
AddWidget(path, "Save States", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, ICON_FA_EXCLAMATION_TRIANGLE " WARNING!!!! " ICON_FA_EXCLAMATION_TRIANGLE, WIDGET_TEXT)
|
||||
.Options(WidgetOptions().Color(Colors::Orange));
|
||||
AddWidget(path,
|
||||
"These are NOT like emulator states. They do not save your game progress "
|
||||
"and they WILL break across transitions and load zones (like doors). "
|
||||
"Support for related issues will not be provided.",
|
||||
WIDGET_TEXT);
|
||||
AddWidget(path, "I promise I have read the warning", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_CHEAT("SaveStatePromise"))
|
||||
.Callback([](WidgetInfo& info) {
|
||||
CVarSetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0);
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||
});
|
||||
AddWidget(path, "I understand, enable save states", WIDGET_CVAR_CHECKBOX)
|
||||
.PreFunc([](WidgetInfo& info) { info.isHidden = CVarGetInteger(CVAR_CHEAT("SaveStatePromise"), 0) == 0; })
|
||||
.CVar(CVAR_CHEAT("SaveStatesEnabled"))
|
||||
.Options(CheckboxOptions().Tooltip("F5 to save, F6 to change slots, F7 to load"));
|
||||
|
||||
AddWidget(path, "Beta Quest", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Enable Beta Quest", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_CHEAT("EnableBetaQuest"))
|
||||
|
@ -2100,7 +2084,7 @@ void SohMenu::AddMenuEnhancements() {
|
|||
|
||||
// Timers
|
||||
path.sidebarName = "Timers";
|
||||
AddSidebarEntry("Enhancements", path.sidebarName, 1);
|
||||
AddSidebarEntry("Enhancements", path.sidebarName, 3);
|
||||
AddWidget(path, "Toggle Timers Window", WIDGET_WINDOW_BUTTON)
|
||||
.CVar(CVAR_WINDOW("TimeDisplayEnabled"))
|
||||
.WindowName("Additional Timers")
|
||||
|
|
|
@ -55,6 +55,7 @@ void SohMenu::AddMenuSettings() {
|
|||
WidgetPath path = { "Settings", "General", SECTION_COLUMN_1 };
|
||||
|
||||
// General - Settings
|
||||
AddWidget(path, "General Settings", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Menu Theme", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_SETTING("Menu.Theme"))
|
||||
.Options(ComboboxOptions()
|
||||
|
@ -207,6 +208,7 @@ void SohMenu::AddMenuSettings() {
|
|||
"FPS than your monitor's refresh rate will waste resources, and might give a worse result.";
|
||||
path.sidebarName = "Graphics";
|
||||
AddSidebarEntry("Settings", "Graphics", 3);
|
||||
AddWidget(path, "Graphics Options", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Toggle Fullscreen", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_SETTING("Fullscreen"))
|
||||
.Callback([](WidgetInfo& info) { Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); })
|
||||
|
@ -292,9 +294,12 @@ void SohMenu::AddMenuSettings() {
|
|||
.CVar(CVAR_TEXTURE_FILTER)
|
||||
.Options(ComboboxOptions().Tooltip("Sets the applied Texture Filtering.").ComboMap(textureFilteringMap));
|
||||
|
||||
path.column = SECTION_COLUMN_2;
|
||||
AddWidget(path, "Advanced Graphics Options", WIDGET_SEPARATOR_TEXT);
|
||||
|
||||
// Controls
|
||||
path.sidebarName = "Controls";
|
||||
path.column = SECTION_COLUMN_1;
|
||||
AddSidebarEntry("Settings", "Controls", 2);
|
||||
AddWidget(path, "Controller Bindings", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Popout Bindings Window", WIDGET_WINDOW_BUTTON)
|
||||
|
@ -302,7 +307,9 @@ void SohMenu::AddMenuSettings() {
|
|||
.WindowName("Configure Controller")
|
||||
.Options(WindowButtonOptions().Tooltip("Enables the separate Bindings Window."));
|
||||
|
||||
path.column = SECTION_COLUMN_2;
|
||||
// Input Viewer
|
||||
path.sidebarName = "Input Viewer";
|
||||
AddSidebarEntry("Settings", path.sidebarName, 3);
|
||||
AddWidget(path, "Input Viewer", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Toggle Input Viewer", WIDGET_WINDOW_BUTTON)
|
||||
.CVar(CVAR_WINDOW("InputViewer"))
|
||||
|
@ -318,7 +325,7 @@ void SohMenu::AddMenuSettings() {
|
|||
// Notifications
|
||||
path.sidebarName = "Notifications";
|
||||
path.column = SECTION_COLUMN_1;
|
||||
AddSidebarEntry("Settings", "Notifications", 3);
|
||||
AddSidebarEntry("Settings", path.sidebarName, 3);
|
||||
AddWidget(path, "Position", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_SETTING("Notifications.Position"))
|
||||
.Options(ComboboxOptions()
|
||||
|
|
|
@ -30,7 +30,6 @@ void SohModalWindow::Draw() {
|
|||
}
|
||||
|
||||
void SohModalWindow::DrawElement() {
|
||||
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
|
||||
if (modals.size() > 0) {
|
||||
SohModal curModal = modals.at(0);
|
||||
if (!ImGui::IsPopupOpen(curModal.title_.c_str())) {
|
||||
|
@ -62,7 +61,6 @@ void SohModalWindow::DrawElement() {
|
|||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void SohModalWindow::RegisterPopup(std::string title, std::string message, std::string button1, std::string button2, std::function<void()> button1callback, std::function<void()> button2callback) {
|
||||
|
|
|
@ -515,92 +515,6 @@ namespace UIWidgets {
|
|||
void Separator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f,
|
||||
float extraVerticalBottomPadding = 0.0f);
|
||||
|
||||
/*using ComboVariant = std::variant<const std::unordered_map<int32_t, const char*>&, const std::vector<const char*>&>;
|
||||
|
||||
bool Combobox(const char* label, int32_t* value, ComboVariant comboSource, const ComboboxOptions& options = {}) {
|
||||
bool dirty = false;
|
||||
float startX = ImGui::GetCursorPosX();
|
||||
std::string invisibleLabelStr = "##" + std::string(label);
|
||||
const char* invisibleLabel = invisibleLabelStr.c_str();
|
||||
ImGui::PushID(label);
|
||||
ImGui::BeginGroup();
|
||||
ImGui::BeginDisabled(options.disabled);
|
||||
PushStyleCombobox(options.color);
|
||||
if (options.alignment == ComponentAlignment::Left) {
|
||||
if (options.labelPosition == LabelPosition::Above) {
|
||||
ImGui::Text("%s", label);
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
} else if (options.labelPosition == LabelPosition::Near) {
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(label).x - ImGui::GetStyle().ItemSpacing.x * 2);
|
||||
} else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) {
|
||||
ImGui::SetNextItemWidth(ImGui::CalcTextSize(comboMap.at(*value)).x + ImGui::GetStyle().FramePadding.x * 4 + ImGui::GetStyle().ItemSpacing.x);
|
||||
}
|
||||
} else if (options.alignment == ComponentAlignment::Right) {
|
||||
if (options.labelPosition == LabelPosition::Above) {
|
||||
ImGui::NewLine();
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(label).x);
|
||||
ImGui::Text("%s", label);
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
} else if (options.labelPosition == LabelPosition::Near) {
|
||||
ImGui::SameLine(ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x * 2);
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
} else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) {
|
||||
float width = ImGui::CalcTextSize(comboMap.at(*value)).x + ImGui::GetStyle().FramePadding.x * 4;
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginCombo(invisibleLabel, comboMap.at(*value), options.flags)) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f));
|
||||
for (const auto& pair : comboMap) {
|
||||
if (strlen(pair.second) > 1) {
|
||||
if (ImGui::Selectable(pair.second, pair.first == *value)) {
|
||||
*value = pair.first;
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (options.alignment == ComponentAlignment::Left) {
|
||||
if (options.labelPosition == LabelPosition::Near) {
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("%s", label);
|
||||
} else if (options.labelPosition == LabelPosition::Far) {
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(label).x);
|
||||
ImGui::Text("%s", label);
|
||||
}
|
||||
} else if (options.alignment == ComponentAlignment::Right) {
|
||||
if (options.labelPosition == LabelPosition::Near || options.labelPosition == LabelPosition::Far) {
|
||||
ImGui::SameLine(startX);
|
||||
ImGui::Text("%s", label);
|
||||
}
|
||||
}
|
||||
PopStyleCombobox();
|
||||
ImGui::EndDisabled();
|
||||
ImGui::EndGroup();
|
||||
if (options.disabled && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.disabledTooltip)) {
|
||||
ImGui::SetTooltip("%s", WrappedText(options.disabledTooltip).c_str());
|
||||
} else if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.tooltip)) {
|
||||
ImGui::SetTooltip("%s", WrappedText(options.tooltip).c_str());
|
||||
}
|
||||
ImGui::PopID();
|
||||
return dirty;
|
||||
}
|
||||
|
||||
bool CVarCombobox(const char* label, const char* cvarName, ComboVariant comboSource, const ComboboxOptions& options = {}) {
|
||||
bool dirty = false;
|
||||
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
|
||||
if (Combobox(label, &value, comboSource, options)) {
|
||||
CVarSetInteger(cvarName, value);
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
ShipInit::Init(cvarName);
|
||||
dirty = true;
|
||||
}
|
||||
return dirty;
|
||||
}*/
|
||||
|
||||
float CalcComboWidth(const char* preview_value, ImGuiComboFlags flags);
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue