public void OnPressed(MousePressedEvent e) { if (e.Buttons == System.Windows.Forms.MouseButtons.Right) { shipType = (shipType == ShipType.HORIZONTAL) ? ShipType.VERTICAL : ShipType.HORIZONTAL; Dimension.Swap(ref NewDimension.Width, ref NewDimension.Height); Dimension.Swap(ref StartDimension.Width, ref StartDimension.Height); } dragging = Collisions.Contains(new Point(e.X, e.Y), NewDimension); }
public void OnPressed(MousePressedEvent e) { if (Collisions.Contains(new Point(e.X, e.Y), game.RBot.MapDimension)) { int TestX = e.X; int TestY = e.Y; RenderInfo.CalculateCoord(ref TestX, ref TestY, game.RBot); bool EndGame = dispatcherShots.DispatchShots(TestX, TestY); if (EndGame) { NextState(game.FinishGame); } } }
private void Window_MouseDown(object sender, MouseEventArgs e) { MousePressedEvent me = new MousePressedEvent(e.Button, e.X, e.Y); OnEvent(me); }