What's the best way to deal with Keyboard layouts?

0 favourites
  • 6 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Let's say we make a simple key-binds menu and try to set absolute defaults for it. In this example "WASD" for basic movement. This is all fine on certain keyboard layouts but as soon as AZERTY comes into play, we got a mess on our hands since the appropriate keys for that would be "ZQSD".

    In theory working around this would require to fetch the current keyboard layout and set the defaults based on it on the 1st run of the game. However there don't seem to be any conditions or expressions to do this right now.

    So how do other devs deal with this problem? Do you just set absolute defaults and call it a day, forcing AZERTY users to just rebind themselves?

  • Curious! I wonder if AZERTY is a keyboard with its own region profile on a computer - as in, are the physical scancode values different comparing QWERTY and AZERTY, or, when you plug in an AZERTY keyboard, are you expected to change the keyboard region before it works correctly?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Curious! I wonder if AZERTY is a keyboard with its own region profile on a computer - as in, are the physical scancode values different comparing QWERTY and AZERTY, or, when you plug in an AZERTY keyboard, are you expected to change the keyboard region before it works correctly?

    It must technically already be possible since Construct 3 does detect the correct StringFromCharCode on my German keyboard with flipped Y/Z.

  • One of the reasons Construct's behavior's default controls use arrow keys is because they are consistent across keyboard layouts.

    If you want WASD-style controls, it might be possible to just implement all controls (e.g. both W and Z are up, A and Q are left) and so the first thing people reach for will work - but I'm not sure if there are conflicts if you take in to account other keyboard layouts, especially if you use other keys.

  • One of the reasons Construct's behavior's default controls use arrow keys is because they are consistent across keyboard layouts.

    How does Construct 3 manage to detect the correct keys on my German Keyboard (flipped y/z)? Is that part of the browser js api or did you guys implement a hack'y workaround for detecting keyboard layouts?

  • It doesn't detect Y or Z keys. The default controls only use the arrow keys (up, left, down, right).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)