mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Enable high-res timers on Windows
This should fix issues like #11891, caused by the fps limiting code being unable to operate correctly.
This commit is contained in:
parent
058846d687
commit
7aea5cb88f
@ -268,7 +268,7 @@ if(WIN32)
|
|||||||
else() # Probably MinGW = GCC
|
else() # Probably MinGW = GCC
|
||||||
set(PLATFORM_LIBS "")
|
set(PLATFORM_LIBS "")
|
||||||
endif()
|
endif()
|
||||||
set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib ${PLATFORM_LIBS})
|
set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib winmm.lib ${PLATFORM_LIBS})
|
||||||
|
|
||||||
set(EXTRA_DLL "" CACHE FILEPATH "Optional paths to additional DLLs that should be packaged")
|
set(EXTRA_DLL "" CACHE FILEPATH "Optional paths to additional DLLs that should be packaged")
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
#include <mmsystem.h>
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -766,6 +767,9 @@ bool open_directory(const std::string &path)
|
|||||||
|
|
||||||
inline double get_perf_freq()
|
inline double get_perf_freq()
|
||||||
{
|
{
|
||||||
|
// Also use this opportunity to enable high-res timers
|
||||||
|
timeBeginPeriod(1);
|
||||||
|
|
||||||
LARGE_INTEGER freq;
|
LARGE_INTEGER freq;
|
||||||
QueryPerformanceFrequency(&freq);
|
QueryPerformanceFrequency(&freq);
|
||||||
return freq.QuadPart;
|
return freq.QuadPart;
|
||||||
|
Loading…
Reference in New Issue
Block a user