Closed Marcelo20XX closed 1 year ago
I just looked over the code for handling keyboard mapping for the analog stick, including the Right-Control and Right-Shift modifier handling, and it looks like it is correct. Maybe this is related to the specific game that you are playing which exhibited the problem. Which game(s) have you observed this problem with?
It happens in all the games... I think the problem lies in the coordinates of the analog stick when using a modifier and pressing two directional keys...
In another project they implemented a solution like this and it works slowing the movement by the same amount:
if (pad->stick_x != 0 && pad->stick_y != 0) {
double angle = atan2(pad->stick_y, pad->stick_x);
pad->stick_x = cos(angle) * abs(pad->stick_x);
pad->stick_y = sin(angle) * abs(pad->stick_y);
}
Okay I just pushed a change which should fix this. Can you build from the latest source and test for me?
Yes @richard42 that fixed it, thank you very much. Now it behaves as it should.
Great!
The keyboard's key modifier bugs when pressing a diagonal direction, i.e. when I press up on the key assigned to the up direction of the stick it decreases the movement by the given factor, but if I press a diagonal the modifier bugs out and give me a wrong value and doesn't decrease the movement by the same amount...
This cause the player to move at different speeds when pressing a direction or a diagonal, ideally the movement speed value should be the same between a direction and a diagonal...