mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Added xinput throttling. Issue #503.
This commit is contained in:
parent
b5ab524ee1
commit
8bdc60cfda
1 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <bx/thread.h>
|
#include <bx/thread.h>
|
||||||
#include <bx/mutex.h>
|
#include <bx/mutex.h>
|
||||||
#include <bx/handlealloc.h>
|
#include <bx/handlealloc.h>
|
||||||
|
#include <bx/timer.h>
|
||||||
#include <tinystl/allocator.h>
|
#include <tinystl/allocator.h>
|
||||||
#include <tinystl/string.h>
|
#include <tinystl/string.h>
|
||||||
|
|
||||||
|
@ -116,6 +117,17 @@ namespace entry
|
||||||
|
|
||||||
void update(EventQueue& _eventQueue)
|
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)
|
if (NULL == m_xinputdll)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue