Skip to content

Commit

Permalink
Touchscreen: Fix virtual joystick sometimes going backwards
Browse files Browse the repository at this point in the history
This fixes a regression introduced by 34286d7 / minetest#14075.
  • Loading branch information
grorp committed Mar 17, 2024
1 parent 2213a4c commit 888294d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/inputhandler.cpp
Expand Up @@ -237,7 +237,9 @@ float RealInputHandler::getMovementDirection()

if (x != 0 || z != 0) /* If there is a keyboard event, it takes priority */
return std::atan2(x, z);
else if (g_touchscreengui && g_touchscreengui->getMovementDirection())
// `getMovementDirection() == 0` means forward, so we cannot use
// `getMovementDirection()` as a condition.
else if (g_touchscreengui && g_touchscreengui->getMovementSpeed())
return g_touchscreengui->getMovementDirection();
return joystick.getMovementDirection();
}
Expand Down

0 comments on commit 888294d

Please sign in to comment.