From ce917ced054f33b8df6d4057a053855b7b98330f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=20=D0=91=D0=BE=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Tue, 29 Nov 2022 18:58:13 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B0=D1=81=D1=82=D1=80=D0=B0=D0=BA=D1=82=20?= =?UTF-8?q?=D0=BC=D0=B0=D0=BF=D1=83=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrawingShip.java | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) 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}; + } }