Ability to detect keyboard layout?

N

Noba

Guest
So, question explains it pretty well. Is there a way to detect the keyboard layout?

Since other people use stuff like AZERTY, I'm thinking of adding a feature to detect the keyboard layout, then change what keys gamemaker detects for movement. If anyone has another option (that preferably isn't keyboard rebinding, I'd prefer not to get into this right now) let me know please.
 
B

Bayesian

Guest
GMS has no built in way to do this. You can simply ask the player which layout they have and save it to a file. Or give the player the ability to change all their key binds themselves.
 

Llama_Code

Member
Another way to do it without keyboard rebinding is to use a custom variable and adjust the layout as needed, for example:

Code:
layout = 0  //0 = QWERTY 1 = Dvorak etc.....

if layout = 0
    {
    move_left = ord(“A”)
    move_right = ord(“S”)
    move_down = ord(“D”)
    // etc.....
    }
if layout = 1
{
    move_left = ord(“A”)
    move_right = ord(“O”)
    move_down = ord(“E”)
    // etc.....
    }

if keyboard_check(move_right)
    {
    x += 5;
    }
Then just have a settings menu where a user can select a layout or have them choose one on first run.

You could of course get they keyboard layout from windows, but you would need an extension to get out of the sandbox.
 
Top