From 2a8fa5fef9021bff67a13899832bf6f0a18e6ea1 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 4 May 2018 21:29:22 +0100 Subject: Change: Split up Window::OnTick into OnGameTick and OnRealtimeTick. Adjust timers to work with milliseconds instead of ticks. --- src/main_gui.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main_gui.cpp') diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 199546d43..12ee574bb 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -235,10 +235,11 @@ enum { struct MainWindow : Window { - uint refresh; + int refresh; - static const uint LINKGRAPH_REFRESH_PERIOD = 0xff; - static const uint LINKGRAPH_DELAY = 0xf; + /* Refresh times in milliseconds */ + static const uint LINKGRAPH_REFRESH_PERIOD = 7650; + static const uint LINKGRAPH_DELAY = 450; MainWindow(WindowDesc *desc) : Window(desc) { @@ -253,9 +254,9 @@ struct MainWindow : Window this->refresh = LINKGRAPH_DELAY; } - virtual void OnTick() + virtual void OnRealtimeTick(uint delta_ms) { - if (--this->refresh > 0) return; + if (!TimerElapsed(this->refresh, delta_ms)) return; this->refresh = LINKGRAPH_REFRESH_PERIOD; -- cgit v1.2.3-54-g00ecf