summaryrefslogtreecommitdiff
path: root/src/core/Pad.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-07-24 20:43:51 +0300
committereray orçunus <erayorcunus@gmail.com>2020-07-24 21:35:04 +0300
commit15918feb8eca09c38d7a40d67cca10cecc4affdc (patch)
tree61826572f6be8a55658a8e8e5fc73b57bf5c6c64 /src/core/Pad.cpp
parentbcb2b7a534d6ed38c2109bfff253cfd7b3ca0ca1 (diff)
90% fixes, 10% skel refactoring
Diffstat (limited to 'src/core/Pad.cpp')
-rw-r--r--src/core/Pad.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 944d7b2c..7df548aa 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -8,6 +8,7 @@
#include "common.h"
#include "crossplatform.h"
+#include "platform.h"
#ifdef XINPUT
#include <xinput.h>
#pragma comment( lib, "Xinput9_1_0.lib" )
@@ -544,9 +545,9 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
void CPad::UpdateMouse()
{
+#if defined RW_D3D9 || defined RWLIBS
if ( IsForegroundApp() )
{
-#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
@@ -583,7 +584,10 @@ void CPad::UpdateMouse()
OldMouseControllerState = NewMouseControllerState;
NewMouseControllerState = PCTempMouseControllerState;
}
+ }
#else
+ if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) )
+ {
double xpos = 1.0f, ypos;
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
if (xpos == 0.f)
@@ -621,8 +625,8 @@ void CPad::UpdateMouse()
OldMouseControllerState = NewMouseControllerState;
NewMouseControllerState = PCTempMouseControllerState;
-#endif
}
+#endif
}
CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2)
@@ -1072,6 +1076,13 @@ void CPad::UpdatePads(void)
#else
CapturePad(0);
#endif
+
+ // Improve keyboard input latency part 1
+#ifdef FIX_BUGS
+ OldKeyState = NewKeyState;
+ NewKeyState = TempKeyState;
+#endif
+
#ifdef DETECT_PAD_INPUT_SWITCH
if (GetPad(0)->PCTempJoyState.CheckForInput())
IsAffectedByController = true;
@@ -1101,8 +1112,11 @@ void CPad::UpdatePads(void)
GetPad(1)->OldState.Clear();
#endif
+ // Improve keyboard input latency part 2
+#ifndef FIX_BUGS
OldKeyState = NewKeyState;
NewKeyState = TempKeyState;
+#endif
}
void CPad::ProcessPCSpecificStuff(void)