Fix DebugConsole to work with all keyboards. #640
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The DebugConsole used a really bad switch statement to detect key input.
It was hard-coded to work with a standard US keyboard layout. If using another keyboard layout, it would not work (added wrong character).
It also didn't allow for smooth typing (holding down a key would only type 1 character).
I've changed it to use Core.Window.TextInput event to get the character that the user actually typed. This makes it work with all keyboard layouts, and whatever keyboard profile the user currently has active.
As far I'm aware, this should work for all supported (desktop) platforms. All console functionality remains intact.
Note, that when typing a character that does not exist in the BitmapFont, the font will throw an exception. This is another bug, for another pull request...