SuperTux / supertux

SuperTux source code
https://supertux.org
GNU General Public License v3.0
2.54k stars 492 forks source link

[Bug]: Why can't I look up/down/left/right with WASD? #3083

Closed communist1917 closed 1 month ago

communist1917 commented 1 month ago

SuperTux Version

0.6.3

System Information

Manjaro Linux XFCE

Expected Behavior

I expect looking up or down or left of right

Actual Behavior

Pressing either W or A or S or D does nothing, view of level is not moving a pixel in any direction.

Steps To Reproduce Actual Behavior

Press either W or A or S or D.

Additional Information

No response

Guidelines For Reporting Issues

Frostwithasideofsalt commented 1 month ago

You can already change the peek keybinds to WASD in the options.

communist1917 commented 1 month ago

You can already change the peek keybinds to WASD in the options.

Thank you. In my options WASD buttons were already set as look buttons but they didn't work. Then I reset these buttons and set them again. And after I restrart Supertux they began working. This is strange.

Rusty-Box commented 1 month ago

Imo. WASD should be the default for peeking. Who uses "page-up", "delete", "home", etc. for games anyway? WASD is way more common in games to do something and is way more handy to use when the other hand is preoccupied with arrow keys, as well as being closer to Space and Ctrl. It just fit in better with all the other default key binds

communist1917 commented 1 week ago

I figured out the problem.

If I set lookup buttons as [W], [A], [S], [D] and I launch Supertux while English keyboard layout is active then these buttons will work. But if I launch Supertux while Russian keyboard layout is active, these buttons WILL NOT work.

And vice versa. If I set lookup buttons as [Ц], [Ф], [Ы] [В] when I launch Supertux while Russian keyboard layout is active, these buttons will work. If launch the game while English keyboard layout is active, it WILL NOT work.

Supertux remembers the keyboard layout at the moment it's started and then compares pressed keys with characters that correspond to lookup buttons.

If I want to play, first I have to look what my keyboard layout is, then switch to English if I set lookup buttons as [W], [A], [S], [D] and launch the game. After I launched it I can switch keyboard layout back to Russian one, Supertux will work as expected.

It's kinda annoying...

Supertux algorithm must compare key codes, not key characters.