Mochalov D.V. Hard LabWork1 #1

Merged
eegov merged 7 commits from LabWork01 into master 2022-09-30 09:50:04 +04:00
2 changed files with 26 additions and 8 deletions
Showing only changes of commit 0f8658bfeb - Show all commits

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;
}
}