bevy-console icon indicating copy to clipboard operation
bevy-console copied to clipboard

Can't open the console on a french keyboard

Open miyoku157 opened this issue 3 years ago • 5 comments
trafficstars

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?

miyoku157 avatar Nov 13 '22 12:11 miyoku157

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!

makspll avatar Nov 27 '22 16:11 makspll

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

miyoku157 avatar Dec 01 '22 05:12 miyoku157

Of course, that will be KeyCode::Grave

makspll avatar Dec 01 '22 19:12 makspll

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

miyoku157 avatar Dec 02 '22 07:12 miyoku157

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

makspll avatar Dec 02 '22 17:12 makspll