RichoDemus/bevy-console

Can't open the console on a french keyboard

Opened this issue · 5 comments

Hi,
I just found this crate, and working on a french keyboard. I had hard time to find out why it wasn't working. But i think there is a problem between how the ~ is done?
If i switch my keyboard in eng, i've no problem making the prompt appear. But in french, no way to see it.
I know the french way is quite weird: the ~ is done with Alt-Gr + é
But even so, maybe cause os a weird french encoding: to do a ~ alone we need to hit: Alt-Gr + é followed by space. And it doesn't open the prompt.
Maybe there is a problem with this weird way of doing things?

Hi @miyoku157, this seems like a bevy_input issue to me, the way bevy_console currently checks for keypresses is with:

console.rs

fn console_key_pressed(
    keyboard_input: &KeyboardInput,
    configured_keys: &[ToggleConsoleKey],
) -> bool {
    if !keyboard_input.state.is_pressed() {
        return false;
    }

    for configured_key in configured_keys {
        match configured_key {
            ToggleConsoleKey::KeyCode(configured_key_code) => match keyboard_input.key_code {
                None => continue,
                Some(pressed_key) => {
                    if configured_key_code == &pressed_key {
                        return true;
                    }
                }
            },
            ToggleConsoleKey::ScanCode(configured_scan_code) => {
                if &keyboard_input.scan_code == configured_scan_code {
                    return true;
                }
            }
        }
    }

Please have a look at:
https://bevy-cheatbook.github.io/input/keyboard.html

let me know if this helps!

Can i know what KeyCode or ScanCode are you looking for by default?

Of course, that will be KeyCode::Grave

I just made some tests, indeed in a french keyboard there is no way to get a KeyCode::Grave. If it's an issue with bevy input, should i record an issue on bevy? And it doesn't seem to be the only one. I can't find also LBracket, RBracket, Backslash, Apostrophe. In fact the keys that are remaps into the number key map in french

Indeed I would start there, link this issue on there as well for context, if it turns out it's our fault then report back here