исправил

This commit is contained in:
Макс Бондаренко 2022-11-29 22:21:03 +04:00
parent 1703457b15
commit e822561eec
2 changed files with 9 additions and 13 deletions

View File

@ -10,26 +10,23 @@ public class DrawDeck implements IDrawningDeck {
@Override
public void DrawningDeck(float _startPosX, float _startPosY, int _warmlyShipWidth, Graphics2D g2d, Color bodyColor){
int count = 1;
switch (deckCount)
{
case One:
break;
case Two:
g2d.setColor(bodyColor);
g2d.fillRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY - 20, _warmlyShipWidth * 3 / 5, 20);
g2d.setColor(Color.BLACK);
g2d.drawRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY - 20, _warmlyShipWidth * 3 / 5, 20);
count = 2;
break;
case Three:
for (int i = 1; i < 3; ++i){
g2d.setColor(bodyColor);
g2d.fillRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY - 20 * i, _warmlyShipWidth * 3 / 5, 20);
g2d.setColor(Color.BLACK);
g2d.drawRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY - 20 * i, _warmlyShipWidth * 3 / 5, 20);
}
count = 3;
break;
}
for (int i = 1; i < count; ++i){
g2d.setColor(bodyColor);
g2d.fillRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY - 20 * i, _warmlyShipWidth * 3 / 5, 20);
g2d.setColor(Color.BLACK);
g2d.drawRect((int)(_startPosX + _warmlyShipWidth / 5), (int)_startPosY - 20 * i, _warmlyShipWidth * 3 / 5, 20);
}
}
}

View File

@ -12,7 +12,6 @@ public class DrawingShip extends JPanel {
protected int _warmlyShipWidth = 125; //Ширина отрисовки корабля
protected int _warmlyShipHeight = 50; //Высота отрисовки корабля
private int deckCount = 1;
private IDrawningDeck idd;
//Инициализация