Правки. Базовая часть

This commit is contained in:
Danil Kargin 2022-12-13 10:51:21 +04:00
parent 41281740e9
commit 80d9da1272
2 changed files with 23 additions and 5 deletions

View File

@ -87,7 +87,13 @@ public class FormAirFighter extends JFrame implements ComponentListener{
buttonCreate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_airFighter = new DrawningAirFighter((int)(Math.random() * 300 + 200),(int)(Math.random() * 3000 + 2000), new Color((int)(Math.random() * 255), (int)(Math.random() * 255), (int)(Math.random() * 255)), Integer.parseInt(item), itemEngine);
Color defaultColor = new Color((int)(Math.random() * 255), (int)(Math.random()) * 255, (int)(Math.random() * 255));
Color mainColor = JColorChooser.showDialog(panelForDrawing,
"Select a color", defaultColor);
if(mainColor == null){
mainColor = defaultColor;
}
_airFighter = new DrawningAirFighter((int)(Math.random() * 300 + 200),(int)(Math.random() * 3000 + 2000), mainColor, Integer.parseInt(item), itemEngine);
SetData();
}
});
@ -98,8 +104,20 @@ public class FormAirFighter extends JFrame implements ComponentListener{
buttonModific.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_airFighter = new DrawningUpgradeAirFighter((int)(Math.random() * 300 + 200),(int)(Math.random() * 3000 + 2000), new Color((int)(Math.random() * 255), (int)(Math.random() * 255), (int)(Math.random() * 255)),
new Color((int)(Math.random() * 255), (int)(Math.random()) * 255, (int)(Math.random() * 255)), ((int)(Math.random() * 2)) == 1, ((int)(Math.random() * 2)) == 1, Integer.parseInt(item), itemEngine);
Color defaultColor = new Color((int)(Math.random() * 255), (int)(Math.random()) * 255, (int)(Math.random() * 255));
Color defaultDopColor = new Color((int)(Math.random() * 255), (int)(Math.random()) * 255, (int)(Math.random() * 255));
Color mainColor = JColorChooser.showDialog(panelForDrawing,
"Select a color", defaultColor);
Color dopColor = JColorChooser.showDialog(panelForDrawing,
"Select a color", defaultColor);
if(mainColor == null){
mainColor = defaultColor;
}
if(dopColor == null){
dopColor = defaultDopColor;
}
_airFighter = new DrawningUpgradeAirFighter((int)(Math.random() * 300 + 200),(int)(Math.random() * 3000 + 2000), mainColor,
dopColor, ((int)(Math.random() * 2)) == 1, ((int)(Math.random() * 2)) == 1, Integer.parseInt(item), itemEngine);
SetData();
}
});

View File

@ -37,7 +37,7 @@ public class MapWithSetAirFightersGeneric <T extends IDrawningObject, U extends
/// Вывод всего набора объектов
public BufferedImage ShowSet()
{
BufferedImage bimg = new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_RGB);
BufferedImage bimg = new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_ARGB);
Graphics gr = bimg.createGraphics();
DrawBackground(gr);
DrawAirFighters(gr);
@ -96,7 +96,7 @@ public class MapWithSetAirFightersGeneric <T extends IDrawningObject, U extends
{
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
for (int j = 0; j < _pictureHeight / _placeSizeHeight; ++j)
{//линия рамзетки места
g.setColor(Color.BLACK);
g.drawLine(i * _placeSizeWidth, j * _placeSizeHeight, i *