diff --git a/DrawingShip.java b/DrawingShip.java index f39d47d..2e118eb 100644 --- a/DrawingShip.java +++ b/DrawingShip.java @@ -91,35 +91,6 @@ public class DrawingShip extends JPanel { dd.DrawningDeck(_startPosX, _startPosY, _warmlyShipWidth, g2d, warmlyShip.GetBodyColor()); } - /*@Override - public void paintComponent(Graphics g){ - if (GetWarmlyShip() == null) return; - - if (_startPosX < 0 || _startPosY < 0 || _pictureWidth == null || _pictureHeight == null) - { - return; - } - super.paintComponent(g); - Graphics2D g2d = (Graphics2D) g; - g2d.setColor(warmlyShip.GetBodyColor()); - int[] xPol = new int[] {(int)(_startPosX), (int)(_startPosX + _warmlyShipWidth), (int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosX + 25)}; - int[] yPol = new int[] {(int)(_startPosY + 20), (int)(_startPosY + 20), (int)(_startPosY + _warmlyShipHeight), (int)(_startPosY + _warmlyShipHeight)}; - g2d.fillPolygon(new Polygon(xPol, yPol, xPol.length)); - g2d.fillRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY, _warmlyShipWidth * 3 / 5, 20); - g2d.setColor(Color.CYAN); - g2d.fillOval((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY + 25, 20, 20); - g2d.fillOval((int)(_startPosX + _warmlyShipWidth * 3 / 5 + 5), (int)_startPosY + 25, 20, 20); - g2d.fillOval((int)(_startPosX + _warmlyShipWidth * 2 / 5 + 2.5f), (int)_startPosY + 25, 20, 20); - g2d.setColor(Color.BLACK); - g2d.drawPolygon(new Polygon(xPol, yPol, xPol.length)); - g2d.drawRect((int)(_startPosX + _warmlyShipWidth / 5), (int)(_startPosY), _warmlyShipWidth * 3 / 5, 20); - g2d.setColor(Color.BLUE); - g2d.drawOval((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY + 25, 20, 20); - g2d.drawOval((int)(_startPosX + _warmlyShipWidth * 3 / 5 + 5), (int)_startPosY + 25, 20, 20); - g2d.drawOval((int)(_startPosX + _warmlyShipWidth * 2 / 5 + 2.5f), (int)_startPosY + 25, 20, 20); - dd.DrawningDeck(_startPosX, _startPosY, _warmlyShipWidth, g2d, warmlyShip.GetBodyColor()); - }*/ - //Изменение границ отрисовки public void ChangeBorders(int width, int height) { @@ -141,4 +112,8 @@ public class DrawingShip extends JPanel { } } + + public float[] GetCurrentPosition() { + return new float[]{_startPosX, _startPosY, _startPosX + _warmlyShipWidth, _startPosY + _warmlyShipHeight}; + } }