Skip to content

Silk.NET.OpenGL.Extensions.ImGui key error #2496

@Romacat2

Description

@Romacat2

Summary

Silk.NET.OpenGL.Extensions.ImGui causes the application to throw an exception due to an "unknown key". The decompiled code shows that the package has a switch with throw for an unknown key (private static ImGuiKey TranslateInputKeyToImGuiKey(Key key)
{
return key switch
{
Key.Tab => ImGuiKey.Tab,
Key.Left => ImGuiKey.LeftArrow,
Key.Right => ImGuiKey.RightArrow,
Key.Up => ImGuiKey.UpArrow,
Key.Down => ImGuiKey.DownArrow,
Key.PageUp => ImGuiKey.PageUp,
Key.PageDown => ImGuiKey.PageDown,
Key.Home => ImGuiKey.Home,
Key.End => ImGuiKey.End,
Key.Insert => ImGuiKey.Insert,
Key.Delete => ImGuiKey.Delete,
Key.Backspace => ImGuiKey.Backspace,
Key.Space => ImGuiKey.Space,
Key.Enter => ImGuiKey.Enter,
Key.Escape => ImGuiKey.Escape,
Key.Apostrophe => ImGuiKey.Apostrophe,
Key.Comma => ImGuiKey.Comma,
Key.Minus => ImGuiKey.Minus,
Key.Period => ImGuiKey.Period,
Key.Slash => ImGuiKey.Slash,
Key.Semicolon => ImGuiKey.Semicolon,
Key.Equal => ImGuiKey.Equal,
Key.LeftBracket => ImGuiKey.LeftBracket,
Key.BackSlash => ImGuiKey.Backslash,
Key.RightBracket => ImGuiKey.RightBracket,
Key.GraveAccent => ImGuiKey.GraveAccent,
Key.CapsLock => ImGuiKey.CapsLock,
Key.ScrollLock => ImGuiKey.ScrollLock,
Key.NumLock => ImGuiKey.NumLock,
Key.PrintScreen => ImGuiKey.PrintScreen,
Key.Pause => ImGuiKey.Pause,
Key.Keypad0 => ImGuiKey.Keypad0,
Key.Keypad1 => ImGuiKey.Keypad1,
Key.Keypad2 => ImGuiKey.Keypad2,
Key.Keypad3 => ImGuiKey.Keypad3,
Key.Keypad4 => ImGuiKey.Keypad4,
Key.Keypad5 => ImGuiKey.Keypad5,
Key.Keypad6 => ImGuiKey.Keypad6,
Key.Keypad7 => ImGuiKey.Keypad7,
Key.Keypad8 => ImGuiKey.Keypad8,
Key.Keypad9 => ImGuiKey.Keypad9,
Key.KeypadDecimal => ImGuiKey.KeypadDecimal,
Key.KeypadDivide => ImGuiKey.KeypadDivide,
Key.KeypadMultiply => ImGuiKey.KeypadMultiply,
Key.KeypadSubtract => ImGuiKey.KeypadSubtract,
Key.KeypadAdd => ImGuiKey.KeypadAdd,
Key.KeypadEnter => ImGuiKey.KeypadEnter,
Key.KeypadEqual => ImGuiKey.KeypadEqual,
Key.ShiftLeft => ImGuiKey.LeftShift,
Key.ControlLeft => ImGuiKey.LeftCtrl,
Key.AltLeft => ImGuiKey.LeftAlt,
Key.SuperLeft => ImGuiKey.LeftSuper,
Key.ShiftRight => ImGuiKey.RightShift,
Key.ControlRight => ImGuiKey.RightCtrl,
Key.AltRight => ImGuiKey.RightAlt,
Key.SuperRight => ImGuiKey.RightSuper,
Key.Menu => ImGuiKey.Menu,
Key.Number0 => ImGuiKey._0,
Key.Number1 => ImGuiKey._1,
Key.Number2 => ImGuiKey._2,
Key.Number3 => ImGuiKey._3,
Key.Number4 => ImGuiKey._4,
Key.Number5 => ImGuiKey._5,
Key.Number6 => ImGuiKey._6,
Key.Number7 => ImGuiKey._7,
Key.Number8 => ImGuiKey._8,
Key.Number9 => ImGuiKey._9,
Key.A => ImGuiKey.A,
Key.B => ImGuiKey.B,
Key.C => ImGuiKey.C,
Key.D => ImGuiKey.D,
Key.E => ImGuiKey.E,
Key.F => ImGuiKey.F,
Key.G => ImGuiKey.G,
Key.H => ImGuiKey.H,
Key.I => ImGuiKey.I,
Key.J => ImGuiKey.J,
Key.K => ImGuiKey.K,
Key.L => ImGuiKey.L,
Key.M => ImGuiKey.M,
Key.N => ImGuiKey.N,
Key.O => ImGuiKey.O,
Key.P => ImGuiKey.P,
Key.Q => ImGuiKey.Q,
Key.R => ImGuiKey.R,
Key.S => ImGuiKey.S,
Key.T => ImGuiKey.T,
Key.U => ImGuiKey.U,
Key.V => ImGuiKey.V,
Key.W => ImGuiKey.W,
Key.X => ImGuiKey.X,
Key.Y => ImGuiKey.Y,
Key.Z => ImGuiKey.Z,
Key.F1 => ImGuiKey.F1,
Key.F2 => ImGuiKey.F2,
Key.F3 => ImGuiKey.F3,
Key.F4 => ImGuiKey.F4,
Key.F5 => ImGuiKey.F5,
Key.F6 => ImGuiKey.F6,
Key.F7 => ImGuiKey.F7,
Key.F8 => ImGuiKey.F8,
Key.F9 => ImGuiKey.F9,
Key.F10 => ImGuiKey.F10,
Key.F11 => ImGuiKey.F11,
Key.F12 => ImGuiKey.F12,
Key.F13 => ImGuiKey.F13,
Key.F14 => ImGuiKey.F14,
Key.F15 => ImGuiKey.F15,
Key.F16 => ImGuiKey.F16,
Key.F17 => ImGuiKey.F17,
Key.F18 => ImGuiKey.F18,
Key.F19 => ImGuiKey.F19,
Key.F20 => ImGuiKey.F20,
Key.F21 => ImGuiKey.F21,
Key.F22 => ImGuiKey.F22,
Key.F23 => ImGuiKey.F23,
Key.F24 => ImGuiKey.F24,
_ => throw new NotImplementedException(),
};
}). To fix it, you need to change the last line to _ => ImGuiKey.None.

Steps to reproduce

Laptop/Keyboard with custom key - like sound change key

Comments

Add any other context about the problem here.

If you know how to fix this issue, please submit a pull request instead!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions