From d36c9190ec562339225a553e4a2045207c7f1d76 Mon Sep 17 00:00:00 2001 From: Nishi Date: Mon, 20 Jul 2026 03:45:50 +0900 Subject: [PATCH] better timer --- CMakeLists.txt | 2 +- include/Mw/MachDep.h | 1 + src/abstract/time.c | 2 +- src/core.c | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1fbb2a..11c3390 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "MSYS") PRIVATE USE_GDI ) - list(APPEND LIBRARIES gdi32) + list(APPEND LIBRARIES gdi32 winmm) target_link_options( Mw PRIVATE diff --git a/include/Mw/MachDep.h b/include/Mw/MachDep.h index 0415b4c..4c98b24 100644 --- a/include/Mw/MachDep.h +++ b/include/Mw/MachDep.h @@ -25,6 +25,7 @@ #ifdef _MILSKO #include +#include #ifndef GWLP_USERDATA #define GWLP_USERDATA GWL_USERDATA #define GWLP_WNDPROC GWL_WNDPROC diff --git a/src/abstract/time.c b/src/abstract/time.c index d1ddb83..59e9774 100644 --- a/src/abstract/time.c +++ b/src/abstract/time.c @@ -2,7 +2,7 @@ #if defined(_WIN32) long MwTimeGetTick(void) { - return GetTickCount(); + return timeGetTime(); } void MwTimeSleep(int ms) { diff --git a/src/core.c b/src/core.c index bcbcb6e..355097c 100644 --- a/src/core.c +++ b/src/core.c @@ -1072,6 +1072,10 @@ int MwLibraryInit(void) { NULL}; int i; +#ifdef _WIN32 + timeBeginPeriod(10); +#endif + #ifdef USE_WAYLAND if(MwWaylandCairoOnly) { calls[0] = MwLLCairoCallInit;