Skip to content

Commit 4528b57

Browse files
authored
Gracefully map unknown or invalid Input.Key to ImGuiKey.None. (#2458)
* start of ImGui unknown key mapping fix. * Gracefully map invalid `Input.Key` to `ImGuiKey.None`.
1 parent e15e305 commit 4528b57

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ internal void PressChar(char keyChar)
287287
/// </summary>
288288
/// <param name="key">The Silk.NET.Input.Key to translate.</param>
289289
/// <returns>The corresponding ImGuiKey.</returns>
290-
/// <exception cref="NotImplementedException">When the key has not been implemented yet.</exception>
291290
private static ImGuiKey TranslateInputKeyToImGuiKey(Key key)
292291
{
293292
return key switch
@@ -409,7 +408,7 @@ private static ImGuiKey TranslateInputKeyToImGuiKey(Key key)
409408
Key.F22 => ImGuiKey.F22,
410409
Key.F23 => ImGuiKey.F23,
411410
Key.F24 => ImGuiKey.F24,
412-
_ => throw new NotImplementedException(),
411+
_ => ImGuiKey.None, // Key isn't implemented
413412
};
414413
}
415414

0 commit comments

Comments
 (0)