Пример #1
0
        public void KeyPressed(object sender, KeyEventArgs e)
        {
            if (longPress || keyTimer.Enabled)
            {
                return;
            }
            switch (e.KeyCode)
            {
            case Keys.Up:
                longPress = true;
                g.RotatePiece();
                break;

            case Keys.Down:
                longPress = true;
                g.SetFastFall();
                break;

            case Keys.Left:
                g.ShiftPiece(Direction.Left);
                break;

            case Keys.Right:
                g.ShiftPiece(Direction.Right);
                break;

            case Keys.Space:
                g.Stop();
                break;

            case Keys.X:
                g.Start();
                break;
            }

            if (!longPress && !multiPress)
            {
                keyTimer.Elapsed += MultiPressEvent;
                keyTimer.Start();
            }
        }