Exemplo n.º 1
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up)
            {
                game.RotateCurrentShape();
            }

            //if (e.KeyCode == Keys.B)
            //SwitchType();

            if (e.KeyCode == Keys.Q)
            {
                Application.Exit();
            }

            if (e.KeyCode == Keys.Space)
            {
                game.HardDrop();
            }

            if (e.KeyCode == Keys.H)
            {
                game.HoldShape();
            }

            if (gameOver)
            {
                if (e.KeyCode == Keys.S)
                {
                    InitializeGrid();
                    return;
                } // end if
            }     // end if

            if (keysPressed.Contains(e.KeyCode))
            {
                keysPressed.Remove(e.KeyCode);
            }

            keysPressed.Add(e.KeyCode);
        }