r/gamedev•
automathematics

Keyboard Mapping and Localization

Question

I sent a demo of my game to a friend in Sweden and I have a "debug console" mapped to ~ (tilde) key. But his keyboard is a Swedish keyboard, so tilde isn't in the same spot and the key that IS in the same spot does not open the console.

Is there any documentation or blog posts as to how to write a keyboard mapper that maps to different layouts?

switch (e.keyCode) {
                case 192: // tilde
                    this.props.toggleConsole();
                    break;

Interestingly, his escape key (code 27) works just fine...

Anyone with experience with this, help! :)

Posted Jul 21, 2017, 9:56 PM UTC

62
Loading comments…