Fix: Use realtime for error message and console backlog timeouts

This commit is contained in:
glx22
2021-01-07 00:53:10 +01:00
committed by Patric Stout
parent c0d7949d7c
commit 1fb4ed8eef
3 changed files with 17 additions and 12 deletions

View File

@@ -12,6 +12,7 @@
#include "window_gui.h"
#include "console_gui.h"
#include "console_internal.h"
#include "guitimer_func.h"
#include "window_func.h"
#include "string_func.h"
#include "strings_func.h"
@@ -171,6 +172,7 @@ struct IConsoleWindow : Window
static int scroll;
int line_height; ///< Height of one line of text in the console.
int line_offset;
GUITimer truncate_timer;
IConsoleWindow() : Window(&_console_window_desc)
{
@@ -179,6 +181,7 @@ struct IConsoleWindow : Window
this->line_offset = GetStringBoundingBox("] ").width + 5;
this->InitNested(0);
this->truncate_timer.SetInterval(3000);
ResizeWindow(this, _screen.width, _screen.height / 3);
}
@@ -227,8 +230,10 @@ struct IConsoleWindow : Window
}
}
void OnHundredthTick() override
void OnRealtimeTick(uint delta_ms) override
{
if (this->truncate_timer.CountElapsed(delta_ms) == 0) return;
if (IConsoleLine::Truncate() &&
(IConsoleWindow::scroll > IConsoleLine::size)) {
IConsoleWindow::scroll = std::max(0, IConsoleLine::size - (this->height / this->line_height) + 1);