private void OnKeyPressing(object sender, KeyboardPressingEventArgs e)
 {
     keys.AddExclusive(e.Key);
     UpdateCursorPosition(e.Key);
     UpdateText(e.Key);
 }
Esempio n. 2
0
 private void KeyboardPressingEventDispatcher(KeyboardPressingEventArgs e)
 {
     var h = Pressing;
     if (h != null)
         h(this, e);
 }
Esempio n. 3
0
 protected override void OnKeyPressing(object sender, KeyboardPressingEventArgs e)
 {
     base.OnKeyPressing(sender, e);
 }
Esempio n. 4
0
 protected override void OnKeyPressing(object sender, KeyboardPressingEventArgs e)
 {
     switch (e.Key)
     {
         case Keys.W:
             if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Up), player1))
                 player1.Move(PlayerDirections.Up);
             break;
         case Keys.S:
             if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Down), player1))
                 player1.Move(PlayerDirections.Down);
             break;
         case Keys.A:
             if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Left), player1))
                 player1.Move(PlayerDirections.Left);
             break;
         case Keys.D:
             if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Right), player1))
                 player1.Move(PlayerDirections.Right);
             break;
         case Keys.I:
             if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Up), player2))
                 player2.Move(PlayerDirections.Up);
             break;
         case Keys.K:
             if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Down), player2))
                 player2.Move(PlayerDirections.Down);
             break;
         case Keys.J:
             if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Left), player2))
                 player2.Move(PlayerDirections.Left);
             break;
         case Keys.L:
             if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Right), player2))
                 player2.Move(PlayerDirections.Right);
             break;
         case Keys.Left:
             sceneManager.Load<GuiTestScene>();
             break;
         case Keys.Right:
             sceneManager.Load<UtilityTestScene>();
             break;
     }
     base.OnKeyPressing(sender, e);
 }
Esempio n. 5
0
 protected virtual void OnKeyPressing(object sender, KeyboardPressingEventArgs e)
 {
     //add common logic here...
 }