hamsterbyte / Godot-.NET-4x-Developer-Console

18 stars 1 forks source link

Rebindable console toggle key #1

Open JJtheGerman opened 3 months ago

JJtheGerman commented 3 months ago

Hey great console, I very much appreciate the work! One issue with using the static keycodes in code is that they can be in wildly different places on different keyboard layouts. On my finnish keyboard for example the console toggle key is "ö". I have run into this issue in hundreds of different games that hardcode their input.

Anyways, I don't want to open a pull request for 3 lines of code so I will just tell you what I did for my version.

DeveloperConsoleUI.cs | private void CheckInput(InputEventKey key)


    private void CheckInput(InputEventKey key){
        if (!key.Pressed) return;
        switch (key.Keycode){
            case Key.Quoteleft:
                ToggleConsole();
                break;
            case Key.Escape:
                if (!Visible) return;
                ToggleConsole();
                break;
        }

        // This line
        if (Input.IsActionPressed("ToggleConsole")) {
            ToggleConsole();
        }
    }
JJtheGerman commented 3 months ago

Nevermind, I should have probably tested my own code before posting here, that code above breaks input.