Rename latest_log_entries_read to autoscrolling

This commit is contained in:
blankie 2023-01-06 22:13:23 +07:00
parent 21badd1db4
commit 672b39b172
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ static inline void settings_window(Config& config, float* config_write_timer, bo
ImGui::End();
}
static inline void logs_window(bool* latest_log_entries_read, bool* show_logs_window) {
static inline void logs_window(bool* autoscrolling, bool* show_logs_window) {
if (!ImGui::Begin("LogMeow Logs", show_logs_window)) {
ImGui::End();
return;
@ -46,7 +46,7 @@ static inline void logs_window(bool* latest_log_entries_read, bool* show_logs_wi
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar)) {
ImGui::TextUnformatted(log_entries.data(), &log_entries[log_entries.size()]);
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) {
*latest_log_entries_read = true;
*autoscrolling = true;
ImGui::SetScrollHereY(1.0f);
}
}
@ -137,9 +137,9 @@ void event_loop(Config& config, float* config_write_timer, bool* run_event_loop)
}
if (show_logs_window) {
bool latest_log_entries_read = false;
logs_window(&latest_log_entries_read, &show_logs_window);
if (latest_log_entries_read) {
bool autoscrolling = false;
logs_window(&autoscrolling, &show_logs_window);
if (autoscrolling) {
log_entries_read = log_entries.size();
}
}