Pibd-22_Presnyakova.V.V_Cat.../DrawningCatamaran.java
2022-12-05 02:29:28 +04:00

52 lines
1.8 KiB
Java

import java.awt.*;
public class DrawningCatamaran extends DrawningBoat{
public DrawningCatamaran(int speed, float weight, Color bodyColor, Color dopColor, boolean sail, boolean floats)
{
super(speed, weight, bodyColor, 140, 70);
Boat = new EntityCatamaran(speed, weight, bodyColor, dopColor, sail, floats);
}
@Override
public void DrawTransport(Graphics g)
{
if (! (Boat instanceof EntityCatamaran Airbus))
{
return;
}
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.BLACK);
_startPosX += 10;
_startPosY += 5;
super.DrawTransport(g);
_startPosX -= 10;
_startPosY -= 5;
if (Airbus.Sail)
{
// TODO draw Sail
g.drawRect(_startPosX + 70, _startPosY + 50, 22, 16);
g.drawRect(_startPosX + 8, _startPosY + 18, 22, 16);
g.drawOval(_startPosX, _startPosY + 18, 16, 16);
g.drawOval(_startPosX + 62, _startPosY + 50, 16, 16);
g2d.setPaint(Airbus.DopColor);
g.fillRect(_startPosX + 70, _startPosY + 50, 22, 16);
g.fillOval(_startPosX + 84, _startPosY + 50, 16, 16);
g.fillOval(_startPosX + 24, _startPosY + 18, 16, 16);
g.fillRect(_startPosX + 8, _startPosY + 18, 22, 16);
g2d.setPaint(Color.BLACK);
g.fillOval(_startPosX, _startPosY + 18, 16, 16);
g.fillOval(_startPosX + 62, _startPosY + 50, 16, 16);
}
if (Airbus.Floats)
{
// TODO draw Floats
g.drawLine(_startPosX + 70, _startPosY + 20, _startPosX + 70, _startPosY + 35);
g.drawLine(_startPosX + 70, _startPosY + 20, _startPosX + 90, _startPosY + 35);
}
}
}