@@ -11,14 +11,16 @@ public class InputCoalescer : SimpleController
1111 public InputCoalescer ( )
1212 : base ( NullController . Instance . Definition ) { } // is Definition ever read on these subclasses? --yoshi
1313
14- protected virtual void ProcessSubsets ( string button , bool state ) { }
14+ protected virtual void ProcessInput ( string button , bool state )
15+ {
16+ Buttons [ button ] = state ;
17+ }
1518
1619 public void Receive ( InputEvent ie )
1720 {
1821 var state = ie . EventType is InputEventType . Press ;
1922 var button = ie . LogicalButton . ToString ( ) ;
20- Buttons [ button ] = state ;
21- ProcessSubsets ( button , state ) ;
23+ ProcessInput ( button , state ) ;
2224 if ( state ) return ;
2325 // when a button or modifier key is released, all modified key variants with it are released as well
2426 foreach ( var k in Buttons . Keys . Where ( k =>
@@ -30,10 +32,17 @@ public void Receive(InputEvent ie)
3032
3133 public sealed class ControllerInputCoalescer : InputCoalescer
3234 {
33- protected override void ProcessSubsets ( string button , bool state )
35+ protected override void ProcessInput ( string button , bool state )
3436 {
3537 // For controller input, we want Shift+X to register as both Shift and X (for Keyboard controllers)
3638 foreach ( var s in button . Split ( '+' ) ) Buttons [ s ] = state ;
3739 }
40+
41+ public override bool IsPressed ( string button )
42+ {
43+ // Since we split all inputs into their separate physical buttons, we need to check combinations here.
44+ string [ ] buttons = button . Split ( '+' ) ;
45+ return buttons . All ( Buttons . GetValueOrDefault ) ;
46+ }
3847 }
3948}
0 commit comments