Add autoscroll

This commit is contained in:
blankie 2023-01-05 20:53:23 +07:00
parent 3bf47f3a5c
commit 11eb08b08f
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 4 additions and 2 deletions

View File

@ -41,11 +41,13 @@ static inline void logs_window(bool* show_logs_window) {
ImGui::SetClipboardText(log_entries.c_str()); ImGui::SetClipboardText(log_entries.c_str());
} }
// copied from imgui/imgui_demo.cpp: [SECTION] Example App: Debug Console / ShowExampleAppConsole()
ImGui::Separator(); ImGui::Separator();
// copied from imgui/imgui_demo.cpp: [SECTION] Example App: Debug Console / ShowExampleAppConsole()
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar)) { if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar)) {
ImGui::TextUnformatted(log_entries.data(), &log_entries[log_entries.size()]); ImGui::TextUnformatted(log_entries.data(), &log_entries[log_entries.size()]);
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) {
ImGui::SetScrollHereY(1.0f);
}
} }
ImGui::EndChild(); ImGui::EndChild();
ImGui::End(); ImGui::End();