Skip to content

Commit eb6fff8

Browse files
committed
Use strongly-typed Keys[] array.
1 parent 17872c4 commit eb6fff8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ImGui.NET.SampleProgram.XNA/ImGuiRenderer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class ImGuiRenderer
3838
private int _scrollWheelValue;
3939
private int _horizontalScrollWheelValue;
4040
private readonly float WHEEL_DELTA = 120;
41-
private Array _allKeys = Enum.GetValues(typeof(Keys));
41+
private Keys[] _allKeys = Enum.GetValues<Keys>();
42+
4243
public ImGuiRenderer(Game game)
4344
{
4445
var context = ImGui.CreateContext();
@@ -209,9 +210,9 @@ protected virtual void UpdateInput()
209210

210211
foreach (var key in _allKeys)
211212
{
212-
if (TryMapKeys((Keys)key, out ImGuiKey imguikey))
213+
if (TryMapKeys(key, out ImGuiKey imguikey))
213214
{
214-
io.AddKeyEvent(imguikey, keyboard.IsKeyDown((Keys)key));
215+
io.AddKeyEvent(imguikey, keyboard.IsKeyDown(key));
215216
}
216217
}
217218

0 commit comments

Comments
 (0)