mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Fixed position issues on entry arrows.
#implement #story[1266] #fix
This commit is contained in:
@@ -590,7 +590,7 @@ public class GameView3D {
|
|||||||
new Scale(1, lastLocation.distance(location) / 5, 1)
|
new Scale(1, lastLocation.distance(location) / 5, 1)
|
||||||
);
|
);
|
||||||
trail.getChildren().add(segment);
|
trail.getChildren().add(segment);
|
||||||
if (trail.getChildren().size() > 100) {
|
if (trail.getChildren().size() > 50) {
|
||||||
trail.getChildren().remove(0);
|
trail.getChildren().remove(0);
|
||||||
}
|
}
|
||||||
lastLocation = location;
|
lastLocation = location;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
private Label timerLabel;
|
private Label timerLabel;
|
||||||
@FXML
|
@FXML
|
||||||
private StackPane contentAnchorPane;
|
private StackPane contentAnchorPane;
|
||||||
|
|
||||||
private GridPane contentGridPane;
|
private GridPane contentGridPane;
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane rvAnchorPane;
|
private AnchorPane rvAnchorPane;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import javafx.scene.paint.Color;
|
|||||||
import javafx.scene.paint.Paint;
|
import javafx.scene.paint.Paint;
|
||||||
import javafx.scene.shape.Arc;
|
import javafx.scene.shape.Arc;
|
||||||
import javafx.scene.shape.ArcType;
|
import javafx.scene.shape.ArcType;
|
||||||
|
import javafx.scene.shape.Circle;
|
||||||
import javafx.scene.shape.Polygon;
|
import javafx.scene.shape.Polygon;
|
||||||
import javafx.scene.shape.Polyline;
|
import javafx.scene.shape.Polyline;
|
||||||
import javafx.scene.shape.StrokeLineCap;
|
import javafx.scene.shape.StrokeLineCap;
|
||||||
@@ -38,31 +39,46 @@ public class MarkArrowFactory {
|
|||||||
public static Model constructEntryArrow3D (
|
public static Model constructEntryArrow3D (
|
||||||
RoundingSide roundingSide, double angle, ModelType type) {
|
RoundingSide roundingSide, double angle, ModelType type) {
|
||||||
Model entryArrow = ModelFactory.importModel(type);
|
Model entryArrow = ModelFactory.importModel(type);
|
||||||
|
|
||||||
|
double angleDeg = angle;
|
||||||
|
angle = 180 - angle;
|
||||||
angle = Math.toRadians(angle);
|
angle = Math.toRadians(angle);
|
||||||
|
|
||||||
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
||||||
double relativeX = multiplier * 10 * Math.sin(angle + Math.PI / 8);
|
double relativeX = multiplier * 5.7 * Math.sin(angle + Math.PI / 2);
|
||||||
double relativeY = multiplier * 10 * Math.cos(angle + Math.PI / 8);
|
double relativeY = multiplier * 5.7 * Math.cos(angle + Math.PI / 2);
|
||||||
double xStart = relativeX + multiplier * 10 * Math.sin(angle - Math.PI / 2);
|
double xStart = relativeX + multiplier * 8 * Math.sin(angle + Math.PI);
|
||||||
double yStart = relativeY + multiplier * 10 * Math.cos(angle - Math.PI / 2);
|
double yStart = relativeY + multiplier * 8 * Math.cos(angle + Math.PI);
|
||||||
entryArrow.getAssets().getTransforms().addAll(
|
entryArrow.getAssets().getTransforms().addAll(
|
||||||
new Translate(xStart, yStart, 0),
|
new Translate(xStart, yStart, 0),
|
||||||
new Rotate(Math.toDegrees(angle), new Point3D(0,0,1))
|
new Rotate(angleDeg, new Point3D(0,0,1))
|
||||||
);
|
);
|
||||||
return entryArrow;
|
Circle c = new Circle(relativeX, relativeY, 1, Color.RED);
|
||||||
|
Circle v = new Circle(xStart, yStart, 1, Color.BLUE);
|
||||||
|
return new Model(new Group(c, v, entryArrow.getAssets()), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Model constructExitArrow3D (
|
public static Model constructExitArrow3D (
|
||||||
RoundingSide roundingSide, double angle, ModelType type) {
|
RoundingSide roundingSide, double angle, ModelType type) {
|
||||||
Model exitArrow = ModelFactory.importModel(type);
|
Model exitArrow = ModelFactory.importModel(type);
|
||||||
|
|
||||||
|
double angleDeg = angle;
|
||||||
|
angle = 180 - angle;
|
||||||
angle = Math.toRadians(angle);
|
angle = Math.toRadians(angle);
|
||||||
|
|
||||||
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
||||||
double xStart = multiplier * 6 * Math.sin(angle + Math.PI / 8);
|
double xStart = multiplier * 5.7 * Math.sin(angle + Math.PI / 2);
|
||||||
double yStart = multiplier * 6 * Math.cos(angle + Math.PI / 8);
|
double yStart = multiplier * 5.7 * Math.cos(angle + Math.PI / 2);
|
||||||
|
|
||||||
exitArrow.getAssets().getTransforms().addAll(
|
exitArrow.getAssets().getTransforms().addAll(
|
||||||
new Translate(xStart, yStart, 0),
|
new Translate(xStart, yStart, 0),
|
||||||
new Rotate(Math.toDegrees(angle), new Point3D(0,0,1))
|
new Rotate(angleDeg, new Point3D(0,0,1))
|
||||||
);
|
);
|
||||||
return exitArrow;
|
Circle c = new Circle(xStart, yStart, 1, Color.RED);
|
||||||
|
if (roundingSide == RoundingSide.PORT) {
|
||||||
|
c = new Circle(xStart, yStart, 1, Color.GREENYELLOW);
|
||||||
|
}
|
||||||
|
return new Model(new Group(c, exitArrow.getAssets()), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,8 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<AnchorPane fx:id="rvAnchorPane" maxHeight="1.7976931348623157E308"
|
|
||||||
maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
<AnchorPane fx:id="rvAnchorPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" style="-fx-background-color: lightblue;" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.RaceViewController">
|
||||||
prefWidth="1200.0" style="-fx-background-color: skyblue;" xmlns="http://javafx.com/javafx/8"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
|
||||||
fx:controller="seng302.visualiser.controllers.RaceViewController">
|
|
||||||
<children>
|
<children>
|
||||||
<StackPane fx:id="contentAnchorPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="800.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<StackPane fx:id="contentAnchorPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="800.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
|
||||||
@@ -32,15 +29,13 @@
|
|||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="70.0" minHeight="70.0" prefHeight="70.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="70.0" minHeight="70.0" prefHeight="70.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="1.7976931348623157E308" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="250.0" minHeight="250.0" prefHeight="250.0"
|
<RowConstraints maxHeight="250.0" minHeight="250.0" prefHeight="250.0" valignment="BOTTOM" vgrow="SOMETIMES" />
|
||||||
valignment="BOTTOM" vgrow="SOMETIMES"/>
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<GridPane id="timerGrid" fx:id="timerGrid" prefWidth="192.0" styleClass="timer">
|
<GridPane id="timerGrid" fx:id="timerGrid" prefWidth="192.0" styleClass="timer">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="135.0" minWidth="135.0"
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="135.0" minWidth="135.0" prefWidth="135.0" />
|
||||||
prefWidth="135.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
@@ -81,17 +76,14 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane fx:id="chatGridPane" GridPane.columnIndex="2" GridPane.rowIndex="2">
|
<GridPane fx:id="chatGridPane" GridPane.columnIndex="2" GridPane.rowIndex="2">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="390.0"
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="390.0" prefWidth="390.0" />
|
||||||
prefWidth="390.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="1.7976931348623157E308" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0"
|
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||||
vgrow="SOMETIMES"/>
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Pane fx:id="chatHistoryHolder" prefHeight="200.0" prefWidth="200.0"
|
<Pane fx:id="chatHistoryHolder" prefHeight="200.0" prefWidth="200.0" GridPane.hgrow="ALWAYS" GridPane.valignment="BOTTOM" GridPane.vgrow="ALWAYS">
|
||||||
GridPane.hgrow="ALWAYS" GridPane.valignment="BOTTOM" GridPane.vgrow="ALWAYS">
|
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@@ -101,45 +93,37 @@
|
|||||||
</Pane>
|
</Pane>
|
||||||
<GridPane fx:id="chatInputHolder" GridPane.rowIndex="1">
|
<GridPane fx:id="chatInputHolder" GridPane.rowIndex="1">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="90.0"
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="90.0" prefWidth="90.0" />
|
||||||
prefWidth="90.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0"
|
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" valignment="CENTER" vgrow="SOMETIMES" />
|
||||||
valignment="CENTER" vgrow="SOMETIMES"/>
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="chatSend" alignment="CENTER" buttonType="RAISED"
|
<JFXButton fx:id="chatSend" alignment="CENTER" buttonType="RAISED" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="35.0" text="SEND" GridPane.columnIndex="1">
|
||||||
maxHeight="-Infinity" maxWidth="1.7976931348623157E308"
|
|
||||||
minHeight="-Infinity" minWidth="-Infinity" prefHeight="35.0"
|
|
||||||
text="SEND" GridPane.columnIndex="1">
|
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXTextField fx:id="chatInput" maxHeight="35.0" minHeight="-Infinity"
|
<JFXTextField fx:id="chatInput" maxHeight="35.0" minHeight="-Infinity" prefHeight="35.0">
|
||||||
prefHeight="35.0">
|
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="10.0" left="20.0" right="10.0"/>
|
<Insets bottom="10.0" left="20.0" right="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets right="15.0"/>
|
<Insets right="15.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</JFXTextField>
|
</JFXTextField>
|
||||||
</children>
|
</children>
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets top="10.0"/>
|
<Insets top="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="10.0" right="10.0"/>
|
<Insets bottom="10.0" right="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane fx:id="windGridPane" maxHeight="-Infinity" maxWidth="-Infinity"
|
<GridPane fx:id="windGridPane" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="150.0" prefWidth="240.0" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
|
||||||
prefHeight="150.0" prefWidth="240.0" GridPane.halignment="CENTER"
|
|
||||||
GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0" prefWidth="110.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0" prefWidth="110.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="132.0" minWidth="10.0" prefWidth="132.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="132.0" minWidth="10.0" prefWidth="132.0" />
|
||||||
|
|||||||
Reference in New Issue
Block a user