From 8bdc60cfda11965b2bc158b5ab394281398efb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sun, 27 Sep 2015 21:07:08 -0700 Subject: [PATCH] Added xinput throttling. Issue #503. --- examples/common/entry/entry_windows.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/common/entry/entry_windows.cpp b/examples/common/entry/entry_windows.cpp index 0a210853..d31d7a07 100644 --- a/examples/common/entry/entry_windows.cpp +++ b/examples/common/entry/entry_windows.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -116,6 +117,17 @@ namespace entry void update(EventQueue& _eventQueue) { + int64_t now = bx::getHPCounter(); + static int64_t next = now; + + if (now < next) + { + return; + } + + const int64_t timerFreq = bx::getHPFrequency(); + next = now + timerFreq/60; + if (NULL == m_xinputdll) { return;