0 votes

In my application, I added some code to look for the Alt key to be pressed, but it did not seem to work by checking for a scancode equal to KEY_ALT.

So, I checked the scancode on the event, and when I press my Alt key it is being reported as KEY_MENU instead of KEY_ALT. And if I press the Menu key on my keyboard, it reports as KEY_UNKNOWN. I tried a different keyboard to make sure it wasn't just mine and it does the same thing.

Can someone else attempt to recreate this so I can confirm it's not just an issue on my end? Thanks!

func _input(event):
    if (event.type == InputEvent.KEY):
       print(event.scancode)

I get 16777262 (KEY_MENU) when I press Alt, and 33554431 (KEY_UNKNOWN) when I press the Menu key.

asked Aug 30, 2016 in Engine by Ol_Smaug (32 points)
edited Aug 30, 2016 by Ol_Smaug

Share the script you used to the tests would help a bit.

I updated my post with some more details.

1 Answer

0 votes

I have an iMac and use its native keyboard (no menu key) but pressing 'alt' key gives me 16777240 which is correct. Other keys are correct too, according to @Global Scope

answered Aug 31, 2016 by genete (674 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.