Jump to content

Keyboard values for British keyboards


Mumbles
 Share

Recommended Posts

This is probably an issue many of you have overlooked, but both the wiki, and (certainly for C) the headers only list values for keys you would expect to find on a US keyboard. Those of us with British keyboards are probably (in fact almost certainly) in a minority, but it's irritating when you're hard coding a specific button for the console. Yes, I know hard coding is normally considered bad practice, but it's normally considered OK for the console button not to be redefinable.

 

The irritation comes from the fact that on a standard US keyboard, the key next to the number 1 is ` and with shift held down, it's ~ and so you can check for it by using KeyHit(KEY_TILDE).

 

Unfortunately, that's not the case for British keyboards, our ~ is next to the enter key, instead, our key next to the number 1 generates:

 

` on it's own

¬ when pressed with shift

¦ when pressed with Alt Gr (That's another key that US keyboards don't have... It's in place if the right alt, but doesn't behave the same way). Some keyboards show it as a solid bar, with the split bar on the backslash. It may be down to OS, but Windows XP, when set to the English UK keyboard, produces the split bar

 

(As a side note, UK users might have noticed the Euro currency sign on the 4 key, shared with the dollar sign, again, that's produced with the Alt Gr key. European vowels with accents are produced the same way too (áéíóú although it doesn't work with the Spanish letter ñ), but since Leadwerks can't test for secondary or tertiary key functions, that's just a bit of a "did you know")

 

Back on track, the key I wanted the number for, isn't listed in the header files so I had to make a quick for loop to see which key it was, and I've done the same for the other problematic key: The backslash, which is in a totally different place on our keyboards when compared to US keyboards (ours is next to the left shift)

 

enum
{
KEY_UK_SPLITBAR = 223,
KEY_UK_BACKSLASH = 226
};

 

There is also an irregularity:

 

The hash (#) key, which also produces a tilde (~) when shift is pressed is tested with the number 222, which is KEY_QUOTES

 

The quote (') key, which also produces an at sign (@) when shift is pressed is tested with the value 223, which is KEY_TILDE

 

As you see, these two are in the wrong order on British keyboards. Not exactly a show stopper, but could cause some confusion if you're someone's game with hard coded keys and they don't seem to respond, or if a game has a text input capability and the input doesn't seem to match.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...