International Keyboards

I’m working on a project that I began on MacOS 9 and then ported just
today to MacOS X.
Everything worked pefectly, and I was very happy. However, I did notice
one problem
I have in MacOS X that I didn’t have in MacOS 9.

It seems the implementation of the keyboard in the X version differs
from the 9 version
in that when running in MacOS 9, my program catches my push of the E key
in Dvorak
as an SDLK_d. Which is great. It means people with alternate keyboard
layouts can
still play the game with the same keys on the keyboard, and switch
keyboard layouts
without reconfiguring their keys.

However, in MacOS X, in order to generate the SDL_KeyEvent SDLK_d I need
to push
the Dvorak D key which is the J key on a standard QWERTY keyboard. This
means that
people playing the game in MacOS X need to reconfigure their keys for
the keyboard
layout they are using.

Is there any way around this?

-Randall

At 12:33 Uhr -0500 18.11.2001, Randall Leeds wrote:

I’m working on a project that I began on MacOS 9 and then ported
just today to MacOS X.
Everything worked pefectly, and I was very happy. However, I did
notice one problem
I have in MacOS X that I didn’t have in MacOS 9.

It seems the implementation of the keyboard in the X version differs
from the 9 version
in that when running in MacOS 9, my program catches my push of the E
key in Dvorak
as an SDLK_d. Which is great. It means people with alternate
keyboard layouts can
still play the game with the same keys on the keyboard, and switch
keyboard layouts
without reconfiguring their keys.

However, in MacOS X, in order to generate the SDL_KeyEvent SDLK_d I
need to push
the Dvorak D key which is the J key on a standard QWERTY keyboard.
This means that
people playing the game in MacOS X need to reconfigure their keys
for the keyboard
layout they are using.

Is there any way around this?

Actually, the fact this it “works” like this for you in OS 9 seems to
indicate you are maybe using an outdated version of SDL there?

SDL keysysms are not scancodes. The behaviour of the OS X version
is correct. That of your MacOS 9 version is not.

The problem here is that there is essentially no way to know what is
printed on each key of your keyboard. Now, when you set for your
english keyboard a german mapping (or dvorak or whatever), SDL has to
trust the key map.

Max–

Max Horn
Software Developer

email: mailto:Max_Horn
phone: (+49) 6151-494890

Randall Leeds wrote:

in that when running in MacOS 9, my program catches my push of the E key
in Dvorak
as an SDLK_d. Which is great.

it’s completely b0rken — the key with ‘E’ printed on it should generate
the SDLK_e sym

It means people with alternate keyboard
layouts can
still play the game with the same keys on the keyboard, and switch
keyboard layouts
without reconfiguring their keys.

no it doesn’t. It means that the game says “press the Y key to release
a fooblitz”, and the luser hammers Y but no fooblitz appears

This means that people playing the game in MacOS X need to
reconfigure their keys for the keyboard layout they are using.

in fact, it means that everyone who doesn’t have your keyboard layout needs
to redefine their keys in your game

Is there any way around this?

yes. It’s good game design to use as few keys as possible in a game.
Console games get away with a small handful of buttons. Using few
keys makes it easier to design a default layout that’s usable with many
different keyboards, and it also makes it easier for the user to change
if he’s unhappy with the bindings. Not to mention it makes the game
easier and more fun to play