private void Tetris_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left || e.KeyCode == Keys.A) { e.SuppressKeyPress = true; Left_Arrow?.Invoke(); panel_field.Invalidate(); } else if (e.KeyCode == Keys.Right || e.KeyCode == Keys.D) { e.SuppressKeyPress = true; Right_Arrow?.Invoke(); panel_field.Invalidate(); } }
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) { Left_Arrow?.Invoke(); panel1.Invalidate(); } else if (e.KeyCode == Keys.Right) { Right_Arrow?.Invoke(); panel1.Invalidate(); } else if (e.KeyCode == Keys.Down) { timer1.Interval = 100; } }
private void GameBoy_key_down(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) // When left arrow is pressed { MessageBox.Show("dziaĆa"); Left_Arrow?.Invoke(); // Invokean event screen.Invalidate(); // Refreshing the screen synchronously } else if (e.KeyCode == Keys.Right) // When right arrow is pressed { Right_Arrow?.Invoke(); // Invokean event screen.Invalidate(); // Refreshing the screen synchronously } else if (e.KeyCode == Keys.Down) // When down arrow is pressed { timer1.Interval = arrow_down_speed; // speed up the game } }
private void GameBoy_button_right(object sender, MouseEventArgs e) { Right_Arrow?.Invoke(); // Invokean event screen.Invalidate(); // Refreshing the screen synchronously }