Merge pull request #921 from PurpleHato/RandoItemTrackerNotesSpace

ADD: Rando Item Tracker Personnal Note space
This commit is contained in:
briaguya 2022-08-02 05:22:29 -07:00 committed by GitHub
commit 646237c4ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -973,6 +973,38 @@ void DrawItemTracker(bool& open) {
ImGui::SameLine(spacingX * 5);
DrawSong(QUEST_SONG_PRELUDE);
ImGui::EndGroup();
// Item Tracker Custom Notes area
if (CVar_GetS32("gItemTrackerNotes", 0)) {
ImGui::BeginGroup();
struct ItemTrackerNotes {
static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) {
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) {
ImVector<char>* itemTrackerNotes = (ImVector<char>*)data->UserData;
IM_ASSERT(itemTrackerNotes->begin() == data->Buf);
itemTrackerNotes->resize(
data->BufSize); // NB: On resizing calls, generally data->BufSize == data->BufTextLen + 1
data->Buf = itemTrackerNotes->begin();
}
return 0;
}
static bool TrackerNotesInputTextMultiline(const char* label, ImVector<char>* itemTrackerNotes, const ImVec2& size = ImVec2(0, 0),
ImGuiInputTextFlags flags = 0) {
IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
return ImGui::InputTextMultiline(label, itemTrackerNotes->begin(), (size_t)itemTrackerNotes->size(),
size, flags | ImGuiInputTextFlags_CallbackResize,
ItemTrackerNotes::TrackerNotesResizeCallback,
(void*)itemTrackerNotes);
}
};
static ImVector<char> itemTrackerNotes;
if (itemTrackerNotes.empty()) {
itemTrackerNotes.push_back(0);
}
ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 16), ImGuiInputTextFlags_AllowTabInput);
ImGui::EndGroup();
}
ImGui::EndTabItem();
}
@ -986,6 +1018,8 @@ void DrawItemTracker(bool& open) {
SohImGui::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay");
SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor");
SohImGui::Tooltip("Will dispaly non-warp songs with randomizer\ncolors instead of pure white");
SohImGui::EnhancementCheckbox("Personal notes space", "gItemTrackerNotes");
SohImGui::Tooltip("Adds a textbox under the item tracker to keep your own notes in");
SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, "");
SohImGui::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256,