imgui 1.90.6 -> 1.91.6 (#4838)

This commit is contained in:
briaguya 2025-01-11 02:02:05 -05:00 committed by GitHub
parent 3b26bd0402
commit 6a5e5e2a75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 113 additions and 77 deletions

@ -1 +1 @@
Subproject commit 7fc73766ed4c636b49e2218d948100ee7782456e Subproject commit 9a974e002f84cd1fe834ee9d2fa4ccf16d899e0f

View File

@ -4,9 +4,6 @@
#ifdef __cplusplus #ifdef __cplusplus
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include "AudioCollection.h" #include "AudioCollection.h"

View File

@ -5,9 +5,6 @@
#include "Context.h" #include "Context.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h" #include "soh/cvar_prefixes.h"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <cmath> #include <cmath>

View File

@ -2,9 +2,6 @@
#include "stdint.h" #include "stdint.h"
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>

View File

@ -18,9 +18,6 @@
#include <Window.h> #include <Window.h>
#include <Context.h> #include <Context.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h> #include <imgui_internal.h>
#undef PATH_HACK #undef PATH_HACK

View File

@ -455,8 +455,11 @@ void DrawInventoryTab() {
uint8_t item = gSaveContext.inventory.items[index]; uint8_t item = gSaveContext.inventory.items[index];
if (item != ITEM_NONE) { if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping.find(item)->second; const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
selectedIndex = index; selectedIndex = index;
ImGui::OpenPopup(itemPopupPicker); ImGui::OpenPopup(itemPopupPicker);
} }
@ -503,8 +506,11 @@ void DrawInventoryTab() {
ImGui::SameLine(); ImGui::SameLine();
} }
const ItemMapEntry& slotEntry = possibleItems[pickerIndex]; const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(0, 0), ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id; gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
// Set adult trade item flag if you're playing adult trade shuffle in rando // Set adult trade item flag if you're playing adult trade shuffle in rando
if (IS_RANDO && if (IS_RANDO &&
@ -986,8 +992,11 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
uint8_t item = items[CUR_UPG_VALUE(categoryId)]; uint8_t item = items[CUR_UPG_VALUE(categoryId)];
if (item != ITEM_NONE) { if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping[item]; const ItemMapEntry& slotEntry = itemMapping[item];
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
ImGui::OpenPopup(upgradePopupPicker); ImGui::OpenPopup(upgradePopupPicker);
} }
} else { } else {
@ -1014,8 +1023,11 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
UIWidgets::SetLastItemHoverText("None"); UIWidgets::SetLastItemHoverText("None");
} else { } else {
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]]; const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
Inventory_ChangeUpgrade(categoryId, pickerIndex); Inventory_ChangeUpgrade(categoryId, pickerIndex);
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
@ -1051,8 +1063,11 @@ void DrawEquipmentTab() {
bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0; bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0;
const ItemMapEntry& entry = itemMapping[equipmentValues[i]]; const ItemMapEntry& entry = itemMapping[equipmentValues[i]];
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasEquip) { if (hasEquip) {
gSaveContext.inventory.equipment &= ~bitMask; gSaveContext.inventory.equipment &= ~bitMask;
} else { } else {
@ -1150,8 +1165,11 @@ void DrawQuestItemButton(uint32_t item) {
uint32_t bitMask = 1 << entry.id; uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasQuestItem) { if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask; gSaveContext.inventory.questItems &= ~bitMask;
} else { } else {
@ -1168,8 +1186,11 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0; bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasItem) { if (hasItem) {
gSaveContext.inventory.dungeonItems[scene] &= ~bitMask; gSaveContext.inventory.dungeonItems[scene] &= ~bitMask;
} else { } else {
@ -1215,8 +1236,11 @@ void DrawQuestStatusTab() {
uint32_t bitMask = 1 << entry.id; uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasQuestItem) { if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask; gSaveContext.inventory.questItems &= ~bitMask;
} else { } else {

View File

@ -715,15 +715,18 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::PushID(item); ImGui::PushID(item);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
PlandomizerItemImageCorrection(plandomizerRandoRetrieveItem(item)); PlandomizerItemImageCorrection(plandomizerRandoRetrieveItem(item));
if (ImGui::ImageButton(textureID, auto name = plandomizerRandoRetrieveItem(item).GetName().english;
imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
if (std::find(infiniteItemList.begin(), infiniteItemList.end(), plandoLogData[index].checkRewardItem.GetRandomizerGet()) == infiniteItemList.end()) { if (std::find(infiniteItemList.begin(), infiniteItemList.end(), plandoLogData[index].checkRewardItem.GetRandomizerGet()) == infiniteItemList.end()) {
PlandomizerAddToItemList(plandoLogData[index].checkRewardItem); PlandomizerAddToItemList(plandoLogData[index].checkRewardItem);
} }
plandoLogData[index].checkRewardItem = plandomizerRandoRetrieveItem(item); plandoLogData[index].checkRewardItem = plandomizerRandoRetrieveItem(item);
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
UIWidgets::Tooltip(plandomizerRandoRetrieveItem(item).GetName().english.c_str()); UIWidgets::Tooltip(name.c_str());
PlandomizerOverlayText(std::make_pair(plandomizerRandoRetrieveItem(item), 1)); PlandomizerOverlayText(std::make_pair(plandomizerRandoRetrieveItem(item), 1));
ImGui::PopID(); ImGui::PopID();
} }
@ -741,8 +744,11 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::PushID(itemIndex); ImGui::PushID(itemIndex);
auto itemToDraw = drawSlots.first; auto itemToDraw = drawSlots.first;
PlandomizerItemImageCorrection(drawSlots.first); PlandomizerItemImageCorrection(drawSlots.first);
if (ImGui::ImageButton(textureID, auto name = drawSlots.first.GetName().english;
imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
if (itemToDraw.GetRandomizerGet() >= RG_PROGRESSIVE_HOOKSHOT && if (itemToDraw.GetRandomizerGet() >= RG_PROGRESSIVE_HOOKSHOT &&
itemToDraw.GetRandomizerGet() <= RG_PROGRESSIVE_GORONSWORD) { itemToDraw.GetRandomizerGet() <= RG_PROGRESSIVE_GORONSWORD) {
plandoLogData[index].checkRewardItem = drawSlots.first; plandoLogData[index].checkRewardItem = drawSlots.first;
@ -757,7 +763,7 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
if (!isClicked) { if (!isClicked) {
UIWidgets::Tooltip(drawSlots.first.GetName().english.c_str()); UIWidgets::Tooltip(name.c_str());
} }
ImGui::PopID(); ImGui::PopID();
@ -786,12 +792,16 @@ void PlandomizerDrawIceTrapPopUp(uint32_t index) {
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::PushID(items.first); ImGui::PushID(items.first);
auto name = Rando::StaticData::RetrieveItem(items.first).GetName().english;
PlandomizerItemImageCorrection(Rando::StaticData::RetrieveItem(items.first)); PlandomizerItemImageCorrection(Rando::StaticData::RetrieveItem(items.first));
if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
plandoLogData[index].iceTrapModel = Rando::StaticData::RetrieveItem(items.first); plandoLogData[index].iceTrapModel = Rando::StaticData::RetrieveItem(items.first);
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
}; };
UIWidgets::Tooltip(Rando::StaticData::RetrieveItem(items.first).GetName().english.c_str()); UIWidgets::Tooltip(name.c_str());
auto itemObject = Rando::StaticData::RetrieveItem(items.first); auto itemObject = Rando::StaticData::RetrieveItem(items.first);
PlandomizerOverlayText(std::make_pair(itemObject, 1)); PlandomizerOverlayText(std::make_pair(itemObject, 1));
@ -808,13 +818,17 @@ void PlandomizerDrawItemSlots(uint32_t index) {
ImGui::PushID(index); ImGui::PushID(index);
PlandoPushImageButtonStyle(); PlandoPushImageButtonStyle();
PlandomizerItemImageCorrection(plandoLogData[index].checkRewardItem); PlandomizerItemImageCorrection(plandoLogData[index].checkRewardItem);
if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { auto name = plandoLogData[index].checkRewardItem.GetName().english;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
shouldPopup = true; shouldPopup = true;
temporaryItem = plandoLogData[index].checkRewardItem; temporaryItem = plandoLogData[index].checkRewardItem;
ImGui::OpenPopup("ItemList"); ImGui::OpenPopup("ItemList");
}; };
PlandoPopImageButtonStyle(); PlandoPopImageButtonStyle();
UIWidgets::Tooltip(plandoLogData[index].checkRewardItem.GetName().english.c_str()); UIWidgets::Tooltip(name.c_str());
PlandomizerOverlayText(std::make_pair(plandoLogData[index].checkRewardItem, 1)); PlandomizerOverlayText(std::make_pair(plandoLogData[index].checkRewardItem, 1));
PlandomizerDrawItemPopup(index); PlandomizerDrawItemPopup(index);
ImGui::PopID(); ImGui::PopID();
@ -852,12 +866,16 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
PlandomizerItemImageCorrection(plandoLogData[index].iceTrapModel); PlandomizerItemImageCorrection(plandoLogData[index].iceTrapModel);
PlandoPushImageButtonStyle(); PlandoPushImageButtonStyle();
if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { auto name = plandoLogData[index].iceTrapModel.GetName().english;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
shouldTrapPopup = true; shouldTrapPopup = true;
ImGui::OpenPopup("TrapList"); ImGui::OpenPopup("TrapList");
}; };
PlandoPopImageButtonStyle(); PlandoPopImageButtonStyle();
UIWidgets::Tooltip(plandoLogData[index].iceTrapModel.GetName().english.c_str()); UIWidgets::Tooltip(name.c_str());
PlandomizerDrawIceTrapPopUp(index); PlandomizerDrawIceTrapPopUp(index);
ImGui::SameLine(); ImGui::SameLine();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -934,8 +952,11 @@ void PlandomizerDrawOptions() {
for (auto& hash : plandoHash) { for (auto& hash : plandoHash) {
ImGui::PushID(index); ImGui::PushID(index);
textureID = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gSeedTextures[hash].tex); textureID = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gSeedTextures[hash].tex);
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_UP"), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { auto upRet = ImGui::ImageButton("HASH_ARROW_UP", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_UP"),
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
ImGui::PopStyleVar();
if (upRet) {
if (hash + 1 >= gSeedTextures.size()) { if (hash + 1 >= gSeedTextures.size()) {
hash = 0; hash = 0;
} }
@ -944,8 +965,11 @@ void PlandomizerDrawOptions() {
} }
} }
ImGui::Image(textureID, ImVec2(35.0f, 35.0f)); ImGui::Image(textureID, ImVec2(35.0f, 35.0f));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_DWN"), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { auto downRet = ImGui::ImageButton("HASH_ARROW_DWN", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_DWN"),
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
ImGui::PopStyleVar();
if (downRet) {
if (hash == 0) { if (hash == 0) {
hash = gSeedTextures.size() - 1; hash = gSeedTextures.size() - 1;
} }

View File

@ -14,9 +14,6 @@
#include "soh/UIWidgets.hpp" #include "soh/UIWidgets.hpp"
#include "3drando/custom_messages.hpp" #include "3drando/custom_messages.hpp"
#include "../../UIWidgets.hpp" #include "../../UIWidgets.hpp"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h> #include <imgui_internal.h>
#include "../custom-message/CustomMessageTypes.h" #include "../custom-message/CustomMessageTypes.h"

View File

@ -432,8 +432,10 @@ void TimeSplitsPopUpContext() {
ImGui::BeginTable("Token Table", 2); ImGui::BeginTable("Token Table", 2);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
SplitsPushImageButtonStyle(); SplitsPushImageButtonStyle();
ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("QUEST_SKULL_TOKEN"), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 2.0f, ImVec4(0, 0, 0, 0)); ImGui::ImageButton("QUEST_SKULL_TOKEN", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("QUEST_SKULL_TOKEN"),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0));
ImGui::PopStyleVar();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
SplitsPopImageButtonStyle(); SplitsPopImageButtonStyle();
ImGui::PushItemWidth(150.0f); ImGui::PushItemWidth(150.0f);
@ -479,8 +481,11 @@ void TimeSplitsPopUpContext() {
SplitObject& popupObject = *findID; SplitObject& popupObject = *findID;
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::PushID(popupObject.splitID); ImGui::PushID(popupObject.splitID);
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(popupObject.splitImage), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 2, ImVec4(0, 0, 0, 0), popupObject.splitTint)) { auto ret = ImGui::ImageButton(popupObject.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(popupObject.splitImage),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), popupObject.splitTint);
ImGui::PopStyleVar();
if (ret) {
splitList.push_back(popupObject); splitList.push_back(popupObject);
if (splitList.size() == 1) { if (splitList.size() == 1) {
splitList[0].splitTimeStatus = SPLIT_STATUS_ACTIVE; splitList[0].splitTimeStatus = SPLIT_STATUS_ACTIVE;
@ -650,8 +655,11 @@ void TimeSplitsDrawSplitsList() {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, IM_COL32(47, 79, 90, 255)); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, IM_COL32(47, 79, 90, 255));
} }
TimeSplitsGetImageSize(split.splitID); TimeSplitsGetImageSize(split.splitID);
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
imageSize, ImVec2(0, 0), ImVec2(1, 1), imagePadding, ImVec4(0, 0, 0, 0), split.splitTint)) { auto ret = ImGui::ImageButton(split.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage),
imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), split.splitTint);
ImGui::PopStyleVar();
if (ret) {
TimeSplitsSkipSplit(dragIndex); TimeSplitsSkipSplit(dragIndex);
} }
HandleDragAndDrop(splitList, dragIndex, split.splitName); HandleDragAndDrop(splitList, dragIndex, split.splitName);
@ -722,9 +730,11 @@ void TimeSplitsDrawItemList(uint32_t type) {
ImGui::PushID(split.splitID); ImGui::PushID(split.splitID);
TimeSplitsGetImageSize(split.splitID); TimeSplitsGetImageSize(split.splitID);
SplitsPushImageButtonStyle(); SplitsPushImageButtonStyle();
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
imageSize, ImVec2(0, 0), ImVec2(1, 1), imagePadding, ImVec4(0, 0, 0, 0), split.splitTint)) { auto ret = ImGui::ImageButton(split.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage),
imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), split.splitTint);
ImGui::PopStyleVar();
if (ret) {
if (popupList.contains(split.splitID) && (split.splitType < SPLIT_TYPE_BOSS)) { if (popupList.contains(split.splitID) && (split.splitType < SPLIT_TYPE_BOSS)) {
popupID = split.splitID; popupID = split.splitID;
ImGui::OpenPopup("TimeSplitsPopUp"); ImGui::OpenPopup("TimeSplitsPopUp");
@ -875,8 +885,11 @@ void TimeSplitsDrawManageList() {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + offsetX); // Apply the offset to center ImGui::SetCursorPosX(ImGui::GetCursorPosX() + offsetX); // Apply the offset to center
} }
TimeSplitsGetImageSize(data.splitID); TimeSplitsGetImageSize(data.splitID);
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(data.splitImage), ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
imageSize, ImVec2(0, 0), ImVec2(1, 1), imagePadding, ImVec4(0, 0, 0, 0), data.splitTint)) { auto ret = ImGui::ImageButton(data.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(data.splitImage),
imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), data.splitTint);
ImGui::PopStyleVar();
if (ret) {
removeIndex = index; removeIndex = index;
} }
HandleDragAndDrop(splitList, index, splitList[index].splitName); HandleDragAndDrop(splitList, index, splitList[index].splitName);

View File

@ -3,9 +3,6 @@
#pragma once #pragma once
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <array> #include <array>
#include <map> #include <map>

View File

@ -8,9 +8,6 @@
#include "SohGui.hpp" #include "SohGui.hpp"
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h> #include <imgui_internal.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>

View File

@ -1,7 +1,4 @@
#include "SohMenuBar.h" #include "SohMenuBar.h"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include "regex" #include "regex"
#include "public/bridge/consolevariablebridge.h" #include "public/bridge/consolevariablebridge.h"

View File

@ -7,9 +7,6 @@
#include "UIWidgets.hpp" #include "UIWidgets.hpp"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h> #include <imgui_internal.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
@ -159,7 +156,7 @@ namespace UIWidgets {
ImGui::RenderFrame(check_bb.Min, check_bb.Max, ImGui::GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding); ImGui::RenderFrame(check_bb.Min, check_bb.Max, ImGui::GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark); ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark);
ImU32 cross_col = ImGui::GetColorU32(ImVec4(0.50f, 0.50f, 0.50f, 1.00f)); ImU32 cross_col = ImGui::GetColorU32(ImVec4(0.50f, 0.50f, 0.50f, 1.00f));
bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0; bool mixed_value = (g.LastItemData.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
if (mixed_value) { if (mixed_value) {
// Undocumented tristate/mixed/indeterminate checkbox (#2644) // Undocumented tristate/mixed/indeterminate checkbox (#2644)
// This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox) // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox)
@ -789,12 +786,17 @@ namespace UIWidgets {
if (!ImGui::ItemAdd(bb, id)) if (!ImGui::ItemAdd(bb, id))
return false; return false;
if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat) if (g.LastItemData.ItemFlags & ImGuiItemFlags_ButtonRepeat) {
flags |= ImGuiButtonFlags_Repeat; ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
}
bool hovered, held; bool hovered, held;
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, flags); bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, flags);
if (g.LastItemData.ItemFlags & ImGuiItemFlags_ButtonRepeat) {
ImGui::PopItemFlag(); // ImGuiItemFlags_ButtonRepeat;
}
// Render // Render
const ImU32 bg_col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_ButtonActive const ImU32 bg_col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_ButtonActive
: hovered ? ImGuiCol_ButtonHovered : hovered ? ImGuiCol_ButtonHovered

View File

@ -6,9 +6,6 @@
#include <vector> #include <vector>
#include <span> #include <span>
#include <stdint.h> #include <stdint.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h> #include <imgui.h>
#include "soh/ShipInit.hpp" #include "soh/ShipInit.hpp"