GUI: how about this
This commit is contained in:
parent
be9d159985
commit
1b3723c895
|
|
@ -2549,6 +2549,8 @@ class FurnaceGUI {
|
|||
void waveListItem(int index, float* wavePreview, int dir, int asset);
|
||||
void sampleListItem(int index, int dir, int asset);
|
||||
|
||||
void drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted);
|
||||
|
||||
void toggleMobileUI(bool enable, bool force=false);
|
||||
|
||||
void pushToggleColors(bool status);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,52 @@
|
|||
#include <fmt/printf.h>
|
||||
#include <algorithm>
|
||||
|
||||
void FurnaceGUI::drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted) {
|
||||
for (FurnaceGUISysDef& i: category) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
if (!i.subDefs.empty()) {
|
||||
if (ImGui::TreeNode("##TreeShit")) {
|
||||
drawSysDefs(i.subDefs,accepted);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (ImGui::Selectable(i.name,false,ImGuiSelectableFlags_DontClosePopups)) {
|
||||
nextDesc=i.definition;
|
||||
nextDescName=i.name;
|
||||
accepted=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ImGui::BeginTooltip()) {
|
||||
std::map<DivSystem,int> chipCounts;
|
||||
std::vector<DivSystem> chips;
|
||||
for (FurnaceGUISysDefChip chip: i.orig) {
|
||||
if (chipCounts.find(chip.sys)==chipCounts.end()) {
|
||||
chipCounts[chip.sys]=1;
|
||||
chips.push_back(chip.sys);
|
||||
} else {
|
||||
chipCounts[chip.sys]+=1;
|
||||
}
|
||||
}
|
||||
for (size_t chipIndex=0; chipIndex<chips.size(); chipIndex++) {
|
||||
DivSystem chip=chips[chipIndex];
|
||||
const DivSysDef* sysDef=e->getSystemDef(chip);
|
||||
ImGui::PushTextWrapPos(MIN(scrW*dpiScale,400.0f*dpiScale));
|
||||
ImGui::Text("%s (x%d): ",sysDef->name,chipCounts[chip]);
|
||||
ImGui::Text("%s",sysDef->description);
|
||||
ImGui::PopTextWrapPos();
|
||||
if (chipIndex+1<chips.size()) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawNewSong() {
|
||||
bool accepted=false;
|
||||
|
||||
|
|
@ -105,43 +151,7 @@ void FurnaceGUI::drawNewSong() {
|
|||
ImGui::TableNextColumn();
|
||||
if (ImGui::BeginTable("Systems",1,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollY)) {
|
||||
std::vector<FurnaceGUISysDef>& category=(newSongQuery.empty())?(sysCategories[newSongCategory].systems):(newSongSearchResults);
|
||||
for (FurnaceGUISysDef& i: category) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Selectable(i.name,false,ImGuiSelectableFlags_DontClosePopups)) {
|
||||
nextDesc=i.definition;
|
||||
nextDescName=i.name;
|
||||
accepted=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ImGui::BeginTooltip()) {
|
||||
std::map<DivSystem,int> chipCounts;
|
||||
std::vector<DivSystem> chips;
|
||||
for (FurnaceGUISysDefChip chip: i.orig) {
|
||||
if (chipCounts.find(chip.sys)==chipCounts.end()) {
|
||||
chipCounts[chip.sys]=1;
|
||||
chips.push_back(chip.sys);
|
||||
} else {
|
||||
chipCounts[chip.sys]+=1;
|
||||
}
|
||||
}
|
||||
for (size_t chipIndex=0; chipIndex<chips.size(); chipIndex++) {
|
||||
DivSystem chip=chips[chipIndex];
|
||||
const DivSysDef* sysDef=e->getSystemDef(chip);
|
||||
ImGui::PushTextWrapPos(MIN(scrW*dpiScale,400.0f*dpiScale));
|
||||
ImGui::Text("%s (x%d): ",sysDef->name,chipCounts[chip]);
|
||||
ImGui::Text("%s",sysDef->description);
|
||||
ImGui::PopTextWrapPos();
|
||||
if (chipIndex+1<chips.size()) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drawSysDefs(category,accepted);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue