mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
HID: Adjust free look
--HG-- branch : game-device
This commit is contained in:
parent
496f7f268c
commit
7200d17801
1 changed files with 22 additions and 19 deletions
|
@ -182,14 +182,17 @@ void CEventsListener::operator()(const CEvent& event)
|
|||
s_MouseFreeLookLastY = pscY;
|
||||
s_MouseFreeLookWaitCenter = false;
|
||||
}
|
||||
if (s_MouseFreeLookWaitCenter && scX == 0 && scY == 0)
|
||||
|
||||
// NOTE: No 0, 0 center mouse message in Windows (lower mouse message rate), but safe to assume any movement messages are requeued relative to our new position
|
||||
// In case free look bugs on other platform, we may need to push in our own message on setMousePos for Windows
|
||||
if (s_MouseFreeLookWaitCenter) // scX == 0 && scY == 0)
|
||||
{
|
||||
// Centered, ignore
|
||||
// Centered, set last to 0
|
||||
s_MouseFreeLookLastX = 0;
|
||||
s_MouseFreeLookLastY = 0;
|
||||
s_MouseFreeLookWaitCenter = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Get delta since last center
|
||||
sint scXd = scX - s_MouseFreeLookLastX;
|
||||
sint scYd = scY - s_MouseFreeLookLastY;
|
||||
|
@ -201,14 +204,14 @@ void CEventsListener::operator()(const CEvent& event)
|
|||
// updateFreeLookPos is called in updateMouseSmoothing per frame
|
||||
|
||||
// Center cursor
|
||||
if (abs(scX) > (drW >> 3) || abs(scY) > (drH >> 3))
|
||||
bool outsideBounds = ((abs(scX) > (drW >> 3)) || (abs(scY) > (drH >> 3)));
|
||||
if (outsideBounds)
|
||||
{
|
||||
s_MouseFreeLookWaitCenter = true;
|
||||
Driver->setMousePos(0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Event from the Mouse (DOWN BUTTONS)
|
||||
else if(event == EventMouseDownId)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue