Page 1 of 2
Keyboard Layout Problem
Posted: Tue Jan 10, 2012 10:57 pm
by eddy
Hello,
I started developing a game using the LÖVE, but I'm having trouble with the keyboard keys. Some keys are exchanged.
It seems that the Keyboard layout is changed. (I'm from Brazil and the keyboard is different from the U.S.)
The key combinations to insert symbols also does not work, there is already a solution for this? Or I have to manually map the keys?
Sorry my bad English. =(
Re: Keyboard Layout Problem
Posted: Tue Jan 10, 2012 11:10 pm
by MarekkPie
Don't know much about keyboards, but if you are using love.keypressed, perhaps you can find the Unicode for the specific keys that aren't working and map that, since keypressed also provides the unicode value of the key.
Re: Keyboard Layout Problem
Posted: Wed Jan 11, 2012 2:50 am
by eddy
MarekkPie wrote:Don't know much about keyboards, but if you are using love.keypressed, perhaps you can find the Unicode for the specific keys that aren't working and map that, since keypressed also provides the unicode value of the key.
That's exactly what I did. Working now the keys I needed.
Thank you for your help.
Re: Keyboard Layout Problem
Posted: Fri Nov 21, 2014 11:35 pm
by vitto
I've a similar problem, I'm using Italian Layout on a MacBook Air but it seems that the layout of the keyboard for LOVE is different, maybe American?
Re: Keyboard Layout Problem
Posted: Sat Nov 22, 2014 7:59 am
by zorg
I'm using a hungarian keyboard, and it's the same.
Sadly, with love 0.9.x, keypressed doesn't return the unicode value, so i'm stuck with either the textinput callback, or the restriction that i must only define us layout keys as input. (Note that keyreleased never had an unicode value at all, so wanting to use that is impossible in both cases)
Re: Keyboard Layout Problem
Posted: Sat Nov 22, 2014 8:29 pm
by slime
LÖVE relies on SDL for keypressed events. Looking at SDL's Mac-specific source code, it seems to have code to make it use the current keyboard layout for key presses, but maybe it has a bug...
Re: Keyboard Layout Problem
Posted: Sun Nov 23, 2014 2:04 am
by Dattorz
You know, since we're on SDL2 now, we ought to take advantage of this by allowing the developer to distinguish between scancodes and keycodes. That is, the developer could choose whether to have keys map to other layouts either by key position or by letter. This would make localization a lot easier to deal with.
Re: Keyboard Layout Problem
Posted: Sun Nov 23, 2014 2:55 am
by slime
I think having something like love.keyboard.scancodeToKey(scancode) would be useful, but having both scancodes and keycodes for every key-related operation is probably unnecessary and would make the APIs confusing.
For example, that would let games have default keybinds that correspond to whatever keys are at the positions that represent wasd on an American keyboard no matter what the letters are mapped to (in theory), but it wouldn't let developers accidentally make their games ignore the user's key mappings.
Re: Keyboard Layout Problem
Posted: Tue Nov 25, 2014 12:54 am
by megalukes
I gave this up a long time ago. There's no way to fix it I believe. I need to keep copying/pasting all the time if I want to use unicode characters like ú, é, è, ã, ñ, etc. Hope we can fix this someday in the future.
Re: Keyboard Layout Problem
Posted: Tue Nov 25, 2014 2:07 am
by slime
megalukes wrote:I gave this up a long time ago. There's no way to fix it I believe. I need to keep copying/pasting all the time if I want to use unicode characters like ú, é, è, ã, ñ, etc. Hope we can fix this someday in the future.
If I'm understanding correctly, you're using the [wiki]love.textinput[/wiki] callback for text input but it's not giving the expected text? Or are you just talking about key presses (that aren't meant to be used for any sort of text input)?