File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ namespace Silk.NET.Input.Glfw
10
10
{
11
11
internal class GlfwKeyboard : IKeyboard , IGlfwSubscriber
12
12
{
13
- private static readonly Key [ ] _keys = ( ( Keys [ ] ) Enum . GetValues ( typeof ( Keys ) ) ) . Select ( ConvertKey ) . ToArray ( ) ;
13
+ private static readonly Key [ ] _keys = ( ( Keys [ ] ) Enum . GetValues ( typeof ( Keys ) ) ) . Select
14
+ ( ConvertKey )
15
+ . Where ( static x => x != Key . Unknown )
16
+ . Distinct ( )
17
+ . ToArray ( ) ;
14
18
private unsafe WindowHandle * _handle ;
15
19
private GlfwCallbacks . CharCallback ? _char ;
16
20
private GlfwCallbacks . KeyCallback ? _key ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Linq ;
3
4
using Silk . NET . Input . Internals ;
4
5
using Silk . NET . SDL ;
5
6
@@ -18,7 +19,9 @@ public SdlKeyboard(SdlInputContext ctx)
18
19
public string Name { get ; } = "Silk.NET Keyboard (via SDL)" ;
19
20
public int Index { get ; } = 0 ;
20
21
public bool IsConnected { get ; } = true ;
21
- public IReadOnlyList < Key > SupportedKeys { get ; } = new ReadOnlyCollectionListAdapter < Key > ( _keyMap . Values ) ;
22
+
23
+ public IReadOnlyList < Key > SupportedKeys { get ; } =
24
+ _keyMap . Values . Where ( static x => x != Key . Unknown ) . Distinct ( ) . ToArray ( ) ;
22
25
public bool IsKeyPressed ( Key key ) => _keysDown . Contains ( key ) ;
23
26
public event Action < IKeyboard , Key , int > ? KeyDown ;
24
27
public event Action < IKeyboard , Key , int > ? KeyUp ;
You can’t perform that action at this time.
0 commit comments