Пример #1
0
        private void GameForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (currentGame != null)
            {
                if (e.KeyCode == Keys.Up)
                {
                    currentGame.RotatePiece();
                }
                if (e.KeyCode == Keys.Down)
                {
                    currentGame.MovePieceDown();
                }
                if (e.KeyCode == Keys.Left)
                {
                    currentGame.MovePieceLeft();
                }
                if (e.KeyCode == Keys.Right)
                {
                    currentGame.MovePieceRight();
                }
            }

            if (e.KeyCode == Keys.F2)
            {
                StartNewGame();
            }
            if (e.KeyCode == Keys.F3)
            {
                PauseGame();
            }
            if (e.KeyCode == Keys.F1)
            {
                ShowInfo();
            }
            if (e.KeyCode == Keys.F4)
            {
                Close();
            }
        }