Merge pull request #12176 from LunaMoo/mouseImprovements

Mouse improvements
This commit is contained in:
Henrik Rydgård 2019-07-15 22:01:12 +02:00 committed by GitHub
commit eeb3491214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -71,6 +71,7 @@ enum DefaultMaps {
};
const float AXIS_BIND_THRESHOLD = 0.75f;
const float AXIS_BIND_THRESHOLD_MOUSE = 0.01f;
typedef std::map<int, std::vector<KeyDef>> KeyMapping;

View File

@ -884,9 +884,10 @@ void EmuScreen::processAxis(const AxisInput &axis, int direction) {
KeyMap::AxisToPspButton(axis.deviceId, axis.axisId, -direction, &resultsOpposite);
int axisState = 0;
if ((direction == 1 && axis.value >= AXIS_BIND_THRESHOLD)) {
float threshold = axis.deviceId == DEVICE_ID_MOUSE ? AXIS_BIND_THRESHOLD_MOUSE : AXIS_BIND_THRESHOLD;
if (direction == 1 && axis.value >= threshold) {
axisState = 1;
} else if (direction == -1 && axis.value <= -AXIS_BIND_THRESHOLD) {
} else if (direction == -1 && axis.value <= -threshold) {
axisState = -1;
} else {
axisState = 0;

View File

@ -246,8 +246,8 @@ void WindowsHost::PollControllers() {
axisY.value = my;
if (GetUIState() == UISTATE_INGAME || g_Config.bMapMouse) {
if (fabsf(mx) > 0.01f) NativeAxis(axisX);
if (fabsf(my) > 0.01f) NativeAxis(axisY);
NativeAxis(axisX);
NativeAxis(axisY);
}
}