some minor fixes

This commit is contained in:
Zakharov_Rostislav 2023-10-26 23:45:53 +04:00
parent 5c97eb3db4
commit 4ff33ecdf2
7 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import frames.FrameBattleship;
import java.io.IOException; import java.io.IOException;
public class Main { public class Main {

View File

@ -1,3 +1,8 @@
package drawing_objects;
import entities.EntityBattleship;
import enums.DirectionType;
import java.awt.*; import java.awt.*;
public class DrawingBattleship { public class DrawingBattleship {
@ -86,7 +91,9 @@ public class DrawingBattleship {
graphics2D.drawRect(startPosX + 70, startPosY + 12, 18, 26); graphics2D.drawRect(startPosX + 70, startPosY + 12, 18, 26);
graphics2D.drawOval(startPosX + 94, startPosY + 19, 12, 12); graphics2D.drawOval(startPosX + 94, startPosY + 19, 12, 12);
//блоки //блоки
drawingBlocks.drawBlocks(graphics2D, startPosX, startPosY); if (drawingBlocks != null){
drawingBlocks.drawBlocks(graphics2D, startPosX, startPosY);
}
//орудийная башня //орудийная башня
if (entityBattleship.getTurret()) { if (entityBattleship.getTurret()) {
int[] shieldX = new int[] {startPosX + 112, startPosX + 112, startPosX + 119, startPosX + 119, }; int[] shieldX = new int[] {startPosX + 112, startPosX + 112, startPosX + 119, startPosX + 119, };

View File

@ -1,3 +1,7 @@
package drawing_objects;
import enums.BlocksNumber;
import java.awt.*; import java.awt.*;
public class DrawingBlocks { public class DrawingBlocks {

View File

@ -1,3 +1,5 @@
package entities;
import java.awt.*; import java.awt.*;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@ -1,3 +1,5 @@
package enums;
public enum BlocksNumber { public enum BlocksNumber {
TWO, TWO,
FOUR, FOUR,

View File

@ -1,3 +1,5 @@
package enums;
public enum DirectionType { public enum DirectionType {
UP, UP,
DOWN, DOWN,

View File

@ -1,3 +1,8 @@
package frames;
import drawing_objects.DrawingBattleship;
import enums.DirectionType;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -5,6 +10,7 @@ import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Random; import java.util.Random;
public class FrameBattleship extends JFrame { public class FrameBattleship extends JFrame {
private DrawingBattleship drawingBattleship; private DrawingBattleship drawingBattleship;
private JComponent pictureBox; private JComponent pictureBox;