コード例 #1
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.A:
                gameController.SetDirection(Vector2.left);
                break;

            case Keys.Left:
                gameController.SetDirection(Vector2.left);
                break;

            case Keys.D:
                gameController.SetDirection(Vector2.right);
                break;

            case Keys.Right:
                gameController.SetDirection(Vector2.right);
                break;

            case Keys.W:
                gameController.SetDirection(Vector2.up);
                break;

            case Keys.Up:
                gameController.SetDirection(Vector2.up);
                break;

            case Keys.S:
                gameController.SetDirection(Vector2.down);
                break;

            case Keys.Down:
                gameController.SetDirection(Vector2.down);
                break;

            default:
                break;
            }
            Refresh();
        }