лаба01 сложная полностью закончена

This commit is contained in:
Kaehvaman 2025-02-19 19:22:13 +04:00
parent b28d6d2993
commit 0c64c0df9b
5 changed files with 18 additions and 5 deletions

View File

@ -27,6 +27,7 @@ public class ControllerMissileCruiser
private void initialize() {
drawingMissileCruiser = new DrawingMissileCruiser();
graphicsContext = mainCanvas.getGraphicsContext2D();
graphicsContext.setImageSmoothing(false);
spinnerVlsSelector.setValueFactory(new IntegerSpinnerValueFactory(2, 6, 2, 2));
@ -45,7 +46,7 @@ public class ControllerMissileCruiser
Color.rgb(random.nextInt(0, 256), random.nextInt(0, 256), random.nextInt(0, 256)),
random.nextBoolean(), random.nextBoolean()
);
drawingMissileCruiser.getDrawingVLS().setVlsBlockCount(random.nextInt(0, 7));
drawingMissileCruiser.getDrawingVLS().setVlsBlockCount(spinnerVlsSelector.getValue());
drawingMissileCruiser.SetPictureSize((int) mainCanvas.getWidth(), (int) mainCanvas.getHeight());
drawingMissileCruiser.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100));

View File

@ -161,7 +161,7 @@ public class DrawingMissileCruiser {
return;
}
// Fuck JavaFX, I had to use SUBPIXEL offsets to not see antialiasing artifacts
// FUCK JavaFX, I had to use SUBPIXEL offsets to not see antialiasing artifacts
double[] contourPolygonX = new double[] {
posX + 10.75, posX + 116.25, posX + 150, posX + 116.25, posX + 10.75, posX + 0.5, posX + 0.5
};

View File

@ -34,6 +34,7 @@ public class DrawingVLS {
gc.fillRect(x + 43, y + 14, 12, 6);
gc.fillRect(x + 57, y + 14, 12, 6);
gc.drawImage(doubleVlsImage, x, y + 9);
// lack of "break;" is intentional
case VlsBlockCount.four:
gc.fillRect(x + 43, y + 5, 12, 6);
gc.fillRect(x + 57, y + 5, 12, 6);

View File

@ -29,3 +29,8 @@
-fx-background-position: center;
-fx-background-repeat: space;
}
#spinnerVlsSelector .text-field {
-fx-font-size: 15px;
-fx-alignment: center;
}

View File

@ -2,20 +2,26 @@
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="500.0" minWidth="900.0" stylesheets="@StylesMissileCruiser.css" xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kvr.missilecruiser_hard.ControllerMissileCruiser">
<Canvas fx:id="mainCanvas" height="500.0" width="900.0" />
<Button id="buttonCreate" layoutX="14.0" layoutY="455.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="30.0" minWidth="100.0" mnemonicParsing="false" onAction="#buttonCreate_Click" text="Создать" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0">
<Button id="buttonCreate" layoutX="14.0" layoutY="455.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="32.0" minWidth="90.0" mnemonicParsing="false" onAction="#buttonCreate_Click" text="Создать" textAlignment="CENTER" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0">
<font>
<Font size="16.0" />
<Font size="15.0" />
</font>
</Button>
<Button id="buttonRight" layoutX="846.0" layoutY="446.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
<Button id="buttonDown" layoutX="800.0" layoutY="446.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="60.0" />
<Button id="buttonLeft" layoutX="754.0" layoutY="446.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="106.0" />
<Button id="buttonUp" layoutX="800.0" layoutY="399.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="60.0" AnchorPane.rightAnchor="60.0" />
<Spinner fx:id="spinnerVlsSelector" layoutX="827.0" layoutY="15.2" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="26.0" prefWidth="48.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="15.0" />
<Spinner fx:id="spinnerVlsSelector" layoutX="112.0" layoutY="454.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="32.0" prefWidth="52.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="112.0" />
<Label layoutX="171.0" layoutY="459.0" text="VLS Count" AnchorPane.bottomAnchor="19.2" AnchorPane.leftAnchor="171.0">
<font>
<Font size="15.0" />
</font>
</Label>
</AnchorPane>