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

Use ScanCodes instead of KeyCodes for Keyboard mapping #8032

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use ScanCode instead of KeyCode
  • Loading branch information
rastla authored May 18, 2023
commit 491196b31312519d9a8c7f36ba924ec227b14b0f
4 changes: 2 additions & 2 deletions MonoGame.Framework/Platform/SDL/SDLGamePlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void SdlRunLoop()
break;
case Sdl.EventType.KeyDown:
{
var key = KeyboardUtil.ToXna(ev.Key.Keysym.Sym);
var key = KeyboardUtil.ToXna(ev.Key.Keysym.Scancode);
if (!_keys.Contains(key))
_keys.Add(key);
char character = (char)ev.Key.Keysym.Sym;
Expand All @@ -141,7 +141,7 @@ private void SdlRunLoop()
}
case Sdl.EventType.KeyUp:
{
var key = KeyboardUtil.ToXna(ev.Key.Keysym.Sym);
var key = KeyboardUtil.ToXna(ev.Key.Keysym.Scancode);
_keys.Remove(key);
_view.OnKeyUp(new InputKeyEventArgs(key));
break;
Expand Down