Keyboard Layout Problem

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
eddy
Prole
Posts: 2
Joined: Tue Jan 10, 2012 10:39 pm

Keyboard Layout Problem

Post 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. =(
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Keyboard Layout Problem

Post 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.
eddy
Prole
Posts: 2
Joined: Tue Jan 10, 2012 10:39 pm

Re: Keyboard Layout Problem

Post 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.
User avatar
vitto
Prole
Posts: 10
Joined: Wed Nov 19, 2014 5:50 pm
Location: Italy
Contact:

Re: Keyboard Layout Problem

Post 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?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Keyboard Layout Problem

Post 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)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Keyboard Layout Problem

Post 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...
User avatar
Dattorz
Citizen
Posts: 66
Joined: Sat Oct 27, 2012 12:32 am
Contact:

Re: Keyboard Layout Problem

Post 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.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Keyboard Layout Problem

Post 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.
User avatar
megalukes
Citizen
Posts: 94
Joined: Fri Jun 27, 2014 11:29 pm
Location: Brazil

Re: Keyboard Layout Problem

Post 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.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Keyboard Layout Problem

Post 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)?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests