небольшие изменения

This commit is contained in:
Ivan_Starostin 2023-12-22 20:13:31 +04:00
parent 62c4d6185f
commit d7792f53c3
2 changed files with 7 additions and 27 deletions

@ -1,7 +1,6 @@
package drawing_objects; package drawing_objects;
import java.awt.*; import java.awt.*;
//import java.util.Random;
public class DrawingDecks { public class DrawingDecks {
private DecksNumber number; private DecksNumber number;
@ -43,13 +42,4 @@ public class DrawingDecks {
graphics2D.fillRect(_startX + i * 3, _startY - i * 10, lainerwidth - 5 * i -20, 9); graphics2D.fillRect(_startX + i * 3, _startY - i * 10, lainerwidth - 5 * i -20, 9);
} }
} }
} }
/*if(x <= 1 || x > 3){
number = DecksNumber.ONE;
}
if(x == 2)
number = DecksNumber.TWO;
if(x == 3)
number = DecksNumber.THREE;*/
//if(x == 1)
//number = DecksNumber.ONE;

@ -17,17 +17,17 @@ public class DrawingLainer {
public int getShipWidth() {return LAINER_WIDTH;} public int getShipWidth() {return LAINER_WIDTH;}
private final int LAINER_HEIGHT = 70; private final int LAINER_HEIGHT = 70;
public int getShipHeight() {return LAINER_HEIGHT;} public int getShipHeight() {return LAINER_HEIGHT;}
private DrawingDecks drawingBlocks; private DrawingDecks drawingDecks;
public boolean init(int speed, double weight, Color bodyColor, Color public boolean init(int speed, double weight, Color bodyColor, Color
additionalColor, boolean pool, boolean decks, int width, int height, int blocksNumber) { additionalColor, boolean pool, boolean decks, int width, int height, int decksNumber) {
if (width < LAINER_WIDTH || height < LAINER_HEIGHT) if (width < LAINER_WIDTH || height < LAINER_HEIGHT)
return false; return false;
pictureWidth = width; pictureWidth = width;
pictureHeight = height; pictureHeight = height;
entityLainer = new EntityLainer(); entityLainer = new EntityLainer();
entityLainer.init(speed, weight, bodyColor, additionalColor, pool, decks); entityLainer.init(speed, weight, bodyColor, additionalColor, pool, decks);
drawingBlocks = new DrawingDecks(); drawingDecks = new DrawingDecks();
drawingBlocks.setNumber(blocksNumber); drawingDecks.setNumber(decksNumber);
return true; return true;
} }
public void setPosition(int x, int y) { public void setPosition(int x, int y) {
@ -93,25 +93,16 @@ public class DrawingLainer {
int[] pointsY = { startPosY +40, startPosY + 40, startPosY + 70, startPosY + 70 }; int[] pointsY = { startPosY +40, startPosY + 40, startPosY + 70, startPosY + 70 };
Polygon pol = new Polygon(pointsX, pointsY, 4); Polygon pol = new Polygon(pointsX, pointsY, 4);
graphics2D.fillPolygon(pol); graphics2D.fillPolygon(pol);
//возможно трубы
/*Brush brush = new SolidBrush(Color.Black);
Rectangle smokestack1 = new Rectangle(_startPosX + 20, _startPosY, 20, 50);
Rectangle smokestack2 = new Rectangle(_startPosX + 60, _startPosY, 20, 50);
g.FillRectangle(brush, smokestack1);
g.FillRectangle(brush, smokestack2);*/
//1 палуба //1 палуба
int newposX = startPosX+5; int newposX = startPosX+5;
int newposY = startPosY+30; int newposY = startPosY+30;
graphics2D.setPaint(bodyColor); graphics2D.setPaint(bodyColor);
graphics2D.fillRect(newposX, newposY, LAINER_WIDTH - 10, 10); graphics2D.fillRect(newposX, newposY, LAINER_WIDTH - 10, 10);
newposX+=2; newposX+=2;
newposY-=10; newposY-=10;
//доп палубы //доп палубы
if (drawingBlocks != null){ if (drawingDecks != null){
drawingBlocks.drawAddDecks(graphics2D, newposX, newposY, LAINER_WIDTH, additionalColor); drawingDecks.drawAddDecks(graphics2D, newposX, newposY, LAINER_WIDTH, additionalColor);
} }
for (int i = 1; i < 5; i++) for (int i = 1; i < 5; i++)
{ {
@ -133,7 +124,6 @@ public class DrawingLainer {
{ {
graphics2D.drawLine(startPosX + 18, startPosY + 35 + i*10, startPosX + 30, startPosY + 35 + i * 10); graphics2D.drawLine(startPosX + 18, startPosY + 35 + i*10, startPosX + 30, startPosY + 35 + i * 10);
} }
} }
} }
} }