コード例 #1
0
 /// <summary>
 /// A key up event based on when the user releases the key
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleKeyUp(object sender, KeyEventArgs e)
 {
     //If the key was W, then it calls the cancelMoveUp method in the controller
     if (e.KeyCode == Keys.W)
     {
         controller.CancelMoveUp();
     }
     //If the key was A, then it calls the cancelMoveLeft method in the controller
     if (e.KeyCode == Keys.A)
     {
         controller.CancelMoveLeft();
     }
     //If the key was S, then it calls the cancelMoveDown method in the controller
     if (e.KeyCode == Keys.S)
     {
         controller.CancelMoveDown();
     }
     //If the key was D, then it calls the cancelMoveRight method in the controller
     if (e.KeyCode == Keys.D)
     {
         controller.CancelMoveRight();
     }
     e.Handled          = true;
     e.SuppressKeyPress = true;
 }