DrawTransport method added

This commit is contained in:
Данила Мочалов 2022-09-24 18:00:56 +04:00
parent 9c05e95a9b
commit 0f8658bfeb
2 changed files with 26 additions and 8 deletions

View File

@ -80,8 +80,32 @@ class DrawningLocomotive {
}
}
public void DrawTransport() {
//TODO: do!
public void DrawTransport(Graphics g) {
if (_startPosX < 0 || _startPosY < 0
|| _pictureHeight == null || _pictureWidth == null)
{
return;
}
//тело
g.setColor(Color.BLACK);
g.drawRect((int)_startPosX , (int)_startPosY, _locomotiveWidth - 10, _locomotiveHeight - 10);
//окна
g.setColor(Locomotive.getBodyColor());
g.fillRect((int)_startPosX + 10, (int)_startPosY + 10, 10, 10);
g.fillRect((int)_startPosX + 30, (int)_startPosY + 10, 10, 10);
g.fillRect((int)_startPosX + 80, (int)_startPosY + 10, 10, 10);
//дверь
g.setColor(Color.BLACK);
g.drawRect( (int)_startPosX + 50, (int)_startPosY + 10, 10, 20);
//колеса
g.drawOval((int) _startPosX, (int)_startPosY + 40, 10, 10);
g.drawOval((int) _startPosX + 20, (int)_startPosY + 40, 10, 10);
g.drawOval((int) _startPosX + 70, (int)_startPosY + 40, 10, 10);
g.drawOval((int) _startPosX + 90, (int)_startPosY + 40, 10, 10);
//движок
g.setColor(Locomotive.getBodyColor());
g.fillRect((int)_startPosX + 100, (int)_startPosY + 10, 10, 30);
}
public void ChangeBorders(int width, int height)

View File

@ -37,10 +37,4 @@ public class EntityLocomotive {
}
BodyColor = bodyColor;
}
}