Example #1
0
 public IOControl()
 {
     InitializeComponent();
     KeyDown += KeyPressed;
     KeyUp   += KeyReleased;
     InitGraphics();
     g = new GameBoard(this);
     g.Start();
 }
Example #2
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();
            }
        }
Example #3
0
 private void start_MouseUp(object sender, MouseButtonEventArgs e)
 {
     board.Start();
 }