GUI: fix visualizer in centered pattern mode

issue #727
This commit is contained in:
tildearrow 2022-11-15 02:46:04 -05:00
parent 1ce7a67659
commit 1a35ce478f
2 changed files with 31 additions and 4 deletions

View File

@ -386,6 +386,33 @@ void FurnaceGUI::drawDebug() {
ImGui::Text("System Managed Scale: %d",sysManagedScale);
ImGui::TreePop();
}
if (ImGui::TreeNode("Visualizer Debug")) {
if (ImGui::BeginTable("visX",3,ImGuiTableFlags_Borders)) {
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableNextColumn();
ImGui::Text("channel");
ImGui::TableNextColumn();
ImGui::Text("patChanX");
ImGui::TableNextColumn();
ImGui::Text("patChanSlideY");
for (int i=0; i<e->getTotalChannelCount(); i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("%d",i);
ImGui::TableNextColumn();
ImGui::Text("%f",patChanX[i]);
ImGui::TableNextColumn();
ImGui::Text("%f",patChanSlideY[i]);
}
ImGui::EndTable();
}
ImGui::Text("particle count: %ld",particles.size());
ImGui::TreePop();
}
if (ImGui::TreeNode("Playground")) {
if (pgSys<0 || pgSys>=e->song.systemLen) pgSys=0;
if (ImGui::BeginCombo("Chip",fmt::sprintf("%d. %s",pgSys+1,e->getSystemName(e->song.system[pgSys])).c_str())) {

View File

@ -133,14 +133,14 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
for (int j=0; j<chans; j++) {
// check if channel is not hidden
if (!e->curSubSong->chanShow[j]) {
patChanX[j]=ImGui::GetCursorPosX();
patChanX[j]=ImGui::GetCursorScreenPos().x;
continue;
}
int chanVolMax=e->getMaxVolumeChan(j);
if (chanVolMax<1) chanVolMax=1;
const DivPattern* pat=patCache[j];
ImGui::TableNextColumn();
patChanX[j]=ImGui::GetCursorPosX();
patChanX[j]=ImGui::GetCursorScreenPos().x;
// selection highlight flags
int sel1XSum=sel1.xCoarse*32+sel1.xFine;
@ -331,7 +331,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PopStyleColor();
}
ImGui::TableNextColumn();
patChanX[chans]=ImGui::GetCursorPosX();
patChanX[chans]=ImGui::GetCursorScreenPos().x;
}
void FurnaceGUI::drawPattern() {
@ -966,7 +966,7 @@ void FurnaceGUI::drawPattern() {
if (fancyPattern) { // visualizer
e->getCommandStream(cmdStream);
ImDrawList* dl=ImGui::GetWindowDrawList();
ImVec2 off=ImGui::GetWindowPos();
ImVec2 off=ImVec2(0.0f,ImGui::GetWindowPos().y);
// commands
for (DivCommand& i: cmdStream) {