GUI: prepare to fix text overflow

This commit is contained in:
tildearrow 2024-11-09 19:44:28 -05:00
parent b7d52d2d6e
commit 76554cb8a2
2 changed files with 21 additions and 0 deletions

View file

@ -548,6 +548,24 @@ void FurnaceGUI::sameLineMaybe(float width) {
if (ImGui::GetContentRegionAvail().x<width) ImGui::NewLine();
}
void FurnaceGUI::ScrollText(ImGuiID id, const char* text, const ImVec2& size, bool alwaysScroll) {
ImDrawList* dl=ImGui::GetWindowDrawList();
ImGuiWindow* window=ImGui::GetCurrentWindow();
ImVec2 minArea=window->DC.CursorPos;
ImVec2 maxArea=ImVec2(
minArea.x+size.x,
minArea.y+size.y
);
ImRect rect=ImRect(minArea,maxArea);
ImGuiStyle& style=ImGui::GetStyle();
ImGui::ItemSize(size,style.FramePadding.y);
if (ImGui::ItemAdd(rect,id)) {
// TODO
dl->AddText(minArea,ImGui::GetColorU32(ImGuiCol_Text),text);
}
}
const char* FurnaceGUI::getSystemName(DivSystem which) {
/*
if (settings.chipNames) {

View file

@ -2792,6 +2792,9 @@ class FurnaceGUI {
// inverted checkbox
bool InvCheckbox(const char* label, bool* value);
// scrolling text
void ScrollText(ImGuiID id, const char* text, const ImVec2& size=ImVec2(0,0), bool alwaysScroll=false);
// mixer stuff
ImVec2 calcPortSetSize(String label, int ins, int outs);
bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map<unsigned int,ImVec2>& portPos);