diff options
author | Kirk Klobe <kklobe@gmail.com> | 2022-11-09 02:25:59 +0300 |
---|---|---|
committer | Kirk Klobe <kklobe@gmail.com> | 2022-11-10 00:30:27 +0300 |
commit | a3c4d8c6a651dc524cf0f78ebe7bf73422d74311 (patch) | |
tree | 42a1dddfe44527e74bf0b71546c7590aa63e880c | |
parent | 4ecaef10c5c3b0a1b6f6b40d9bbeb0bb0dced950 (diff) |
Convert SDL_Delay() to sleep_for()kk/debugger-use-sleepfor-1
-rw-r--r-- | src/libs/PDCurses/sdl2_queue/pdcutil.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libs/PDCurses/sdl2_queue/pdcutil.cpp b/src/libs/PDCurses/sdl2_queue/pdcutil.cpp index ffa2eacd9..d06c1ec86 100644 --- a/src/libs/PDCurses/sdl2_queue/pdcutil.cpp +++ b/src/libs/PDCurses/sdl2_queue/pdcutil.cpp @@ -1,4 +1,6 @@ /* PDCurses */ +#include <chrono> +#include <thread> #include "pdcsdl.h" @@ -9,16 +11,18 @@ void PDC_beep(void) void PDC_napms(int ms) { + constexpr int nap_interval = 50; + PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); - while (ms > 50) + while (ms > nap_interval) { PDC_pump_and_peep(); - SDL_Delay(50); - ms -= 50; + std::this_thread::sleep_for(std::chrono::milliseconds(nap_interval)); + ms -= nap_interval; } PDC_pump_and_peep(); - SDL_Delay(ms); + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); } const char *PDC_sysname(void) |