|
|
|
|
@ -328,31 +328,29 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
|
double sailRotateAngle; // required rotation for correct sail display
|
|
|
|
|
Image sailImage;
|
|
|
|
|
|
|
|
|
|
// remove when method is finished
|
|
|
|
|
sailRotateAngle = 0;
|
|
|
|
|
sailImage = null;
|
|
|
|
|
|
|
|
|
|
gc.save();
|
|
|
|
|
// right half of points of sail
|
|
|
|
|
if (boatBearing < 180) {
|
|
|
|
|
if (ThisBoat.getInstance().isSailsOut()) {
|
|
|
|
|
if (boatBearing < 180) { // right half of points of sail
|
|
|
|
|
sailImage = sailsRight;
|
|
|
|
|
sailRotateAngle = boatBearing; // math
|
|
|
|
|
sailRotateAngle = boatBearing * 0.5; // math
|
|
|
|
|
xPos -= 1; // right align to boat edge on canvas
|
|
|
|
|
// System.out.println("right side -- boat: " + boatBearing +
|
|
|
|
|
// "|| rotate: " + sailRotateAngle);
|
|
|
|
|
}
|
|
|
|
|
// left half of points of sail
|
|
|
|
|
else {
|
|
|
|
|
else { // left half of points of sail
|
|
|
|
|
sailImage = sailsLeft;
|
|
|
|
|
sailRotateAngle = -(360 - boatBearing); // math
|
|
|
|
|
sailRotateAngle = -(360 - boatBearing) * 0.5; // math
|
|
|
|
|
xPos -= 5; // left align to boat edge on canvas
|
|
|
|
|
// System.out.println("left side -- boat: " + boatBearing +
|
|
|
|
|
// "|| rotate: " + sailRotateAngle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Change the angle of the sail if the sail is out
|
|
|
|
|
if (ThisBoat.getInstance().isSailsOut()) {
|
|
|
|
|
if (boatBearing < 180) {
|
|
|
|
|
sailRotateAngle -= 90;
|
|
|
|
|
} else {
|
|
|
|
|
sailRotateAngle += 90;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// TODO: display luffing sail
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// rotate sails based on boats current heading
|
|
|
|
|
|