コード例 #1
0
        /// <summary>
        /// Handles key inputs
        /// </summary>
        private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Left)
            {
                game.DoAction(TetrisAction.MoveLeft);
            }
            else if (e.Key == System.Windows.Input.Key.Right)
            {
                game.DoAction(TetrisAction.MoveRight);
            }
            else if (e.Key == System.Windows.Input.Key.Down)
            {
                game.DoAction(TetrisAction.Drop);
            }
            else if (e.Key == System.Windows.Input.Key.Up)
            {
                game.DoAction(TetrisAction.Rotate);
            }

            UpdateDisplay();
        }