PIbd-22_Aleikin_A.M._AirBom.../DrawEngines.java

37 lines
2.0 KiB
Java
Raw Permalink Normal View History

2022-11-29 20:50:45 +04:00
import java.awt.*;
public class DrawEngines
{
private Engines numEngines;
public void SetNumEngines(int i) { numEngines = Engines.GetNumEngines(i); }
public void DrawningEngines(float _startPosX, float _startPosY, Graphics2D g2d, int _airBomberWidth, int _airBomberHeight)
{
switch(numEngines)
{
case TwoEngines:
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 20, (int)_startPosY + _airBomberHeight / 2 - 20, 20, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 20, (int)_startPosY + _airBomberHeight / 2 + 10, 20, 10);
break;
case FourEngines:
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 20, (int)_startPosY + _airBomberHeight / 2 - 20, 20, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 20, (int)_startPosY + _airBomberHeight / 2 + 10, 20, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 15, (int)_startPosY + _airBomberHeight / 2 - 35, 15, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 15, (int)_startPosY + _airBomberHeight / 2 + 25, 15, 10);
break;
case SixEngines:
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 20, (int)_startPosY + _airBomberHeight / 2 - 20, 20, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 20, (int)_startPosY + _airBomberHeight / 2 + 10, 20, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 15, (int)_startPosY + _airBomberHeight / 2 - 35, 15, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 15, (int)_startPosY + _airBomberHeight / 2 + 25, 15, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 10, (int)_startPosY + _airBomberHeight / 2 - 50, 10, 10);
g2d.fillRect((int)_startPosX + _airBomberWidth / 2 - 10, (int)_startPosY + _airBomberHeight / 2 + 40, 10, 10);
break;
}
}
}