Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse improvements #12176

Merged
merged 3 commits into from Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Common/KeyMap.h
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions UI/EmuScreen.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Windows/WindowsHost.cpp
Expand Up @@ -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);
}
}

Expand Down