mixer: per-chp peak meters, fix almost every ui issue:

- fix wrong verticaltext clipping
- fix verticaltext overflow centering
- add hscroll to mixer
This commit is contained in:
Eknous-P 2025-10-10 19:36:02 +04:00
parent 76b29fa31c
commit 2108cffec2
4 changed files with 62 additions and 11 deletions

View file

@ -451,14 +451,14 @@ void FurnaceGUI::VerticalText(const char* fmt, ...) {
ImVec2 size=ImGui::CalcTextSize(text);
dl->AddText(pos, ImGui::GetColorU32(ImGuiCol_Text), text);
vtxEnd=dl->_VtxCurrentIdx;
ImGui::ShadeVertsTransformPos(dl, vtxBegin, vtxEnd, pos+ImVec2(size.x,0), 0, -1, pos);
ImGui::ShadeVertsTransformPos(dl, vtxBegin, vtxEnd, pos+ImVec2(size.x,0), 0, -1, ImGui::GetCursorScreenPos());
ImGui::Dummy(ImVec2(size.y,size.x));
}
void FurnaceGUI::VerticalText(float maxSize, bool centered, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
ImVec2 pos=ImGui::GetCursorScreenPos();
ImVec2 pos=ImGui::GetWindowPos();
ImDrawList* dl=ImGui::GetWindowDrawList();
int vtxBegin, vtxEnd;
vtxBegin=dl->_VtxCurrentIdx;
@ -466,10 +466,12 @@ void FurnaceGUI::VerticalText(float maxSize, bool centered, const char* fmt, ...
vsnprintf(text, 4096, fmt, args);
const char* textEol=ImGui::FindRenderedTextEnd(text);
ImVec2 size=ImGui::CalcTextSize(text);
dl->PushClipRect(pos,pos+ImGui::GetWindowSize());
ImGui::RenderTextEllipsis(dl,pos,pos+ImVec2(maxSize,ImGui::GetFontSize()),maxSize,text,textEol,&size);
dl->PopClipRect();
vtxEnd=dl->_VtxCurrentIdx;
float ySize=(size.x>maxSize)?maxSize:size.x;
ImGui::ShadeVertsTransformPos(dl, vtxBegin, vtxEnd, pos, 0, -1, pos+ImVec2(0,ySize+(centered?(maxSize-size.x)/2.0f:0)));
ImGui::ShadeVertsTransformPos(dl, vtxBegin, vtxEnd, pos, 0, -1, ImGui::GetCursorScreenPos()+ImVec2(0,(size.x+ySize)/2+(centered?(maxSize-size.x)/2.0f:0)));
ImGui::Dummy(ImVec2(size.y,centered?maxSize:ySize));
}