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

Add a way to get the physical scancode string: ex: OS.get_physical_scancode_string() #3571

Closed
jitspoe opened this issue Nov 19, 2021 · 2 comments
Milestone

Comments

@jitspoe
Copy link

jitspoe commented Nov 19, 2021

Describe the project you are working on

2.5D platformer (with key rebinding)

Describe the problem or limitation you are having in your project

Using the new physical_scancode system, there's no way to display the correct key for non-qwerty keyboard layouts. Docs suggest using OS.get_scancode_string(event.physical_scancode), but this displays the QWERTY equivalent of the key instead of the key of the current layout. I can't seem to find a way to remap the physical scancode or a function to display the current string of the physical key.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would allow me to properly display the key name regardless of keyboard layout using the physical scancode.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Something like:
var key_string = OS.get_physical_scancode_string(input.physical_scancode)

or:
var scancode = OS.physical_scancode_to_scancode(input.physical_scancode)
var key_string = OS.get_scancode_string(scancode)

If this enhancement will not be used often, can it be worked around with a few lines of script?

I couldn't find a way to -- if there is, it needs better documentation.

Is there a reason why this should be core and not an add-on in the asset library?

Core, os-specific feature of the engine. I don't think that info can be accessed from script.

@akien-mga
Copy link
Member

CC @bruvzg

@akien-mga
Copy link
Member

Fixed by godotengine/godot#56015.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants