Compare commits

...

3 Commits
main ... Lab_1

Author SHA1 Message Date
b819188097 adding comments to code 2024-03-30 01:25:09 +04:00
1dc3aac6cd Done lab 2 2024-03-01 14:36:10 +04:00
312c88cd71 Lab 1 2024-02-17 16:03:46 +04:00
15 changed files with 585 additions and 58 deletions

View File

@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true" editorAttributes="TYPO">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="false" />
</inspection_tool>
</profile>
</component>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">

124
ProjectAirFighter/.idea/uiDesigner.xml generated Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<groupId>com.example.projectairfighter</groupId>
<artifactId>ProjectAirFighter</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ProjectAirFighter</name>

View File

@ -1,14 +0,0 @@
package com.example.projectairfighter;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
public class HelloController {
@FXML
private Label welcomeText;
@FXML
protected void onHelloButtonClick() {
welcomeText.setText("Welcome to JavaFX Application!");
}
}

View File

@ -1,23 +0,0 @@
package com.example.projectairfighter;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class Main extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("hello-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -0,0 +1,12 @@
package com.projectairfighter;
public enum DirectionType {
// Вверх
UP,
// Вниз
DOWN,
// Влево
LEFT,
// Вправо
RIGHT
}

View File

@ -0,0 +1,171 @@
package com.projectairfighter;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import java.util.Random;
public class DrawningAirFighter {
// Сущность
public EntityAirFighter entityAirFighter;
private EngineDrawing engineDrawing;
// Ширина и высота окна
private int pictureWidth = 0;
private int pictureHeight = 0;
// Начальные координаты прорисовки истребителя
private Double startPosX = null;
private Double startPosY = null;
private final int drawningAirFighterWidth = 157;
private final int drawningAirFighterHeight = 140;
// Инициализация
public void init(int speed, double weight, Color bodyColor, Color additionalColor,
boolean bodyRockets, boolean additionalWings) {
Random random = new Random();
engineDrawing = new EngineDrawing();
entityAirFighter = new EntityAirFighter();
entityAirFighter.init(speed, weight, bodyColor, additionalColor,
bodyRockets, additionalWings);
engineDrawing.setCountEngines(random.nextInt(7));
}
// Установка размеров окна
public void setPictureSize(int width, int height) {
if (width <= drawningAirFighterWidth || height <= drawningAirFighterHeight) return;
pictureWidth = width;
pictureHeight = height;
if (startPosX != null && startPosY != null) {
if (startPosX + drawningAirFighterWidth > pictureWidth) {
startPosX = (double) (pictureWidth - drawningAirFighterWidth);
}
if (startPosY + drawningAirFighterHeight > pictureHeight) {
startPosY = (double) (pictureHeight - drawningAirFighterHeight);
}
}
}
// Установка позиции
public void setPosition(double x, double y) {
if (pictureWidth == 0 || pictureHeight == 0) {
return;
}
startPosX = x;
startPosY = y;
if (y + drawningAirFighterHeight > pictureHeight || y < 0) {
startPosY = (double) 0;
}
if (x + drawningAirFighterWidth > pictureWidth || x < 0) {
startPosX = (double) 0;
}
}
// Изменение направления перемещения
public boolean moveTransport(DirectionType direction) {
if (entityAirFighter == null || startPosX == -1 || startPosY == -1) {
return false;
}
return switch (direction) {
case LEFT -> {
if (startPosX - entityAirFighter.getStep() > 0) {
startPosX -= entityAirFighter.getStep();
}
yield true;
}
case UP -> {
if (startPosY - entityAirFighter.getStep() > 0) {
startPosY -= entityAirFighter.getStep();
}
yield true;
}
case RIGHT -> {
if (startPosX + drawningAirFighterWidth + entityAirFighter.getStep() < pictureWidth) {
startPosX += entityAirFighter.getStep();
}
yield true;
}
case DOWN -> {
if (startPosY + drawningAirFighterHeight + entityAirFighter.getStep() < pictureHeight) {
startPosY += entityAirFighter.getStep();
}
yield true;
}
default -> false;
};
}
// Прорисовка объекта
public void drawTransport(GraphicsContext gc) {
if (entityAirFighter == null || startPosX == null || startPosY == null) {
return;
}
if (pictureWidth == 0 || pictureHeight == 0) return;
gc.setFill(entityAirFighter.getBodyColor());
gc.setStroke(entityAirFighter.getBodyColor());
// Прорисовка тела истребителя
gc.strokeRect(startPosX + 10, startPosY + 53, 130, 26);
// Прорисовка носа
gc.fillPolygon(
new double[]{startPosX + 140, startPosX + 165, startPosX + 140},
new double[]{startPosY + 53, startPosY + 66, startPosY + 79},
3
);
// Прорисовка верхней части хвоста
gc.strokePolygon(new double[]{startPosX + 10, startPosX + 10, startPosX + 30, startPosX + 30},
new double[]{startPosY + 23, startPosY + 53, startPosY + 53, startPosY + 38}, 4);
// Прорисовка нижней части хвоста
gc.strokePolygon(new double[]{startPosX + 10, startPosX + 10, startPosX + 30, startPosX + 30},
new double[]{startPosY + 79, startPosY + 109, startPosY + 94, startPosY + 79}, 4);
// Прорисовка верхнего крыла
gc.strokePolygon(new double[]{startPosX + 100, startPosX + 100, startPosX + 70, startPosX + 85},
new double[]{startPosY, startPosY + 53, startPosY + 53, startPosY}, 4);
// Прорисовка нижнего крыла
gc.strokePolygon(new double[]{startPosX + 100, startPosX + 100, startPosX + 85, startPosX + 70},
new double[]{startPosY + 79, startPosY + 133, startPosY + 133, startPosY + 79}, 4);
engineDrawing.drawEngine(gc, entityAirFighter, startPosX, startPosY);
// Дополнительные элементы объекта
if (entityAirFighter.hasBodyRockets()) {
gc.setFill(entityAirFighter.getAdditionalColor());
gc.setStroke(entityAirFighter.getAdditionalColor());
double rocketWidth = 6;
double rocketLength = 15;
double[] rocketsX = {startPosX + 100, startPosX + 100};
for (double rocketPos : rocketsX) {
gc.fillRect(rocketPos, startPosY + 13 - (rocketWidth / 2), rocketLength, rocketWidth);
gc.fillRect(rocketPos, startPosY + 120 - (rocketWidth / 2), rocketLength, rocketWidth);
}
}
if (entityAirFighter.hasAdditionalWings()) {
gc.setStroke(entityAirFighter.getAdditionalColor());
double[] additionalWingTopX = {startPosX + 40, startPosX + 50, startPosX + 60};
double[] additionalWingTopY = {startPosY + 53, startPosY + 38, startPosY + 53};
double[] additionalWingBottomX = {startPosX + 40, startPosX + 50, startPosX + 60};
double[] additionalWingBottomY = {startPosY + 80, startPosY + 95, startPosY + 80};
gc.strokePolygon(additionalWingTopX, additionalWingTopY, 3);
gc.strokePolygon(additionalWingBottomX, additionalWingBottomY, 3);
}
}
}

View File

@ -0,0 +1,13 @@
package com.projectairfighter;
public enum EngineCount {
TWO(2),
FOUR(4),
SIX(6);
private final int value;
EngineCount(int Value) { value = Value; }
public int getValue() { return value; }
}

View File

@ -0,0 +1,72 @@
package com.projectairfighter;
import javafx.scene.canvas.GraphicsContext;
public class EngineDrawing {
private EngineCount engineCount;
public void setCountEngines(int countEngines){
switch (countEngines) {
case 4:
engineCount = EngineCount.FOUR;
break;
case 6:
engineCount = EngineCount.SIX;
break;
default:
engineCount = EngineCount.TWO;
break;
}
}
public void drawEngine(GraphicsContext gc, EntityAirFighter entityAirFighter, double startPosX, double startPosY){
double engineWidth = 6;
double engineHeight = 10;
double[] engineByTail;
double[] engineByWings;
gc.setStroke(entityAirFighter.getAdditionalColor());
// Прорисовка двигателей в зависимости от их количества
switch (engineCount.getValue()) {
case 2:
engineByTail = new double[]{startPosX, startPosX}; // Изменено
for (double rocketPos : engineByTail) {
gc.fillRect(rocketPos, startPosY + 42 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 90 - (engineWidth / 2), engineHeight, engineWidth);
}
break;
case 4:
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX};
for (double rocketPos : engineByTail) {
gc.fillRect(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 53 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 78 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 103 - (engineWidth / 2), engineHeight, engineWidth);
}
break;
case 6:
engineHeight = 15;
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX, startPosX, startPosX};
engineByWings = new double[]{startPosX + 65, startPosX + 65};
for (double rocketPos : engineByWings) {
gc.fillRect(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 107 - (engineWidth / 2), engineHeight, engineWidth);
}
engineHeight = 10;
for (double rocketPos : engineByTail) {
gc.fillRect(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 53 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 78 - (engineWidth / 2), engineHeight, engineWidth);
gc.fillRect(rocketPos, startPosY + 103 - (engineWidth / 2), engineHeight, engineWidth);
}
break;
}
}
}

View File

@ -0,0 +1,51 @@
package com.projectairfighter;
import javafx.scene.paint.Color;
// Перечисление для количества двигателей
public class EntityAirFighter {
// Скорость
private int speed;
// Вес
private double weight;
// Основной цвет
private Color bodyColor;
// Дополнительный цвет (для опциональных элементов)
private Color additionalColor;
// Признак (опция) наличия ракет
private boolean bodyRockets;
// Признак (опция) наличия дополнительных крыльев
private boolean additionalWings;
// Метод для вычисления шага перемещения истребителя
public double getStep() {
return speed * 100 / weight;
}
// Конструктор
public void init(int speed, double weight, Color bodyColor, Color additionalColor,
boolean bodyRockets, boolean additionalWings) {
this.speed = speed;
this.weight = weight;
this.bodyColor = bodyColor;
this.additionalColor = additionalColor;
this.bodyRockets = bodyRockets;
this.additionalWings = additionalWings;
}
public Color getBodyColor() {
return bodyColor;
}
public Color getAdditionalColor() {
return additionalColor;
}
public boolean hasBodyRockets() {
return bodyRockets;
}
public boolean hasAdditionalWings() {
return additionalWings;
}
}

View File

@ -0,0 +1,97 @@
package com.projectairfighter;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.input.KeyEvent;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Random;
public class FormAirFighter extends Application {
private DrawningAirFighter drawningAirFighter;
// Окно отрисовки
@FXML
private Canvas canvasAirFighter;
// Создание объекта
@FXML
private void createAirFighter(ActionEvent event) {
Random random = new Random();
drawningAirFighter = new DrawningAirFighter();
drawningAirFighter.init(random.nextInt(300) + 100, random.nextInt(3000) + 1000,
Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256)),
Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256)),
random.nextBoolean(), random.nextBoolean());
drawningAirFighter.setPictureSize((int) canvasAirFighter.getWidth(), (int) canvasAirFighter.getHeight());
drawningAirFighter.setPosition(random.nextInt(100) + 10, random.nextInt(100) + 10);
Scene scene = canvasAirFighter.getScene();
scene.widthProperty().addListener((observable, oldValue, newValue) -> resizeCanvas());
scene.heightProperty().addListener((observable, oldValue, newValue) -> resizeCanvas());
Draw();
}
// Нажатие кнопок двжиения мышкой
@FXML
private void moveAirFighterByMouse(ActionEvent event) {
if (drawningAirFighter == null) return;
Button btn = (Button) event.getSource();
DirectionType direction = DirectionType.valueOf(btn.getId().toUpperCase());
boolean result = drawningAirFighter.moveTransport(direction);
if (result) Draw();
}
// Нажатие кнопок двжиения клавиатурой
@FXML
private void moveAirFighterByKey(KeyEvent event){
if (drawningAirFighter == null) return;
Button btn = (Button) event.getSource();
DirectionType direction = DirectionType.valueOf(btn.getId().toUpperCase());
boolean result = drawningAirFighter.moveTransport(direction);
if (result) Draw();
}
// Изменение окна отрисовки
@FXML
private void resizeCanvas() {
canvasAirFighter.setWidth(canvasAirFighter.getScene().getWidth());
canvasAirFighter.setHeight(canvasAirFighter.getScene().getHeight());
drawningAirFighter.setPictureSize((int) canvasAirFighter.getWidth(), (int) canvasAirFighter.getHeight());
}
// Функция отрисовки объекта
private void Draw() {
if (drawningAirFighter == null) return;
GraphicsContext gc = canvasAirFighter.getGraphicsContext2D();
gc.clearRect(0, 0, canvasAirFighter.getWidth(), canvasAirFighter.getHeight());
drawningAirFighter.drawTransport(gc);
}
@FXML
@Override
public void start(Stage primaryStage) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(FormAirFighter.class.getResource("Form.fxml"));
Parent root = loader.load();
canvasAirFighter = (Canvas) loader.getNamespace().get("canvasAirFighter");
Scene scene = new Scene(root, 800, 400);
primaryStage.setTitle("Истребитель");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -1,9 +1,9 @@
module com.example.projectairfighter {
module com.projectairfighter {
requires javafx.controls;
requires javafx.fxml;
requires org.controlsfx.controls;
opens com.example.projectairfighter to javafx.fxml;
exports com.example.projectairfighter;
opens com.projectairfighter to javafx.fxml;
exports com.projectairfighter;
}

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Button?>
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.projectairfighter.HelloController">
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding>
<Label fx:id="welcomeText"/>
<Button text="Hello!" onAction="#onHelloButtonClick"/>
</VBox>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.canvas.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="600.0" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.projectairfighter.FormAirFighter">
<Canvas fx:id="canvasAirFighter" height="400.0" width="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Button id="Down" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="↓" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="61.0">
<font>
<Font size="15.0" />
</font>
</Button>
<Button id="Up" layoutX="506.0" layoutY="317.0" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="↑" textAlignment="CENTER" AnchorPane.bottomAnchor="50.0" AnchorPane.rightAnchor="61.0">
<font>
<Font size="15.0" />
</font>
</Button>
<Button id="Left" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="←" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="102.0">
<font>
<Font size="15.0" />
</font>
</Button>
<Button id="Right" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="→" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="20.0">
<font>
<Font size="15.0" />
</font>
</Button>
<Button layoutX="14.0" layoutY="361.0" mnemonicParsing="false" onAction="#createAirFighter" text="Создать" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" />
</AnchorPane>