Merge branch 'boat_movement_smooth' into 'master'

Boats move about smoothly instead of jumping about



See merge request !51
main
Fraser Cope 8 years ago
commit 11a50b6f09

@ -9,12 +9,12 @@ public class GraphCoordinate {
/**
* X (horizontal) coordinate.
*/
private final int x;
private final double x;
/**
* Y (vertical) coordinate.
*/
private final int y;
private final double y;
/**
* Constructor method.
@ -22,7 +22,7 @@ public class GraphCoordinate {
* @param x X coordinate.
* @param y Y coordinate.
*/
public GraphCoordinate(int x, int y) {
public GraphCoordinate(double x, double y) {
this.x = x;
this.y = y;
}
@ -33,7 +33,7 @@ public class GraphCoordinate {
*
* @return x axis Coordinate.
*/
public int getX() {
public double getX() {
return x;
}
@ -42,7 +42,7 @@ public class GraphCoordinate {
*
* @return y axis Coordinate.
*/
public int getY() {
public double getY() {
return y;
}

@ -239,8 +239,8 @@ public class ResizableRaceCanvas extends ResizableCanvas {
//Offset by 20 pixels horizontally.
long xCoord = coordinate.getX() + 20;
long yCoord = coordinate.getY();
double xCoord = coordinate.getX() + 20;
double yCoord = coordinate.getY();
//If the text would extend out of the canvas (to the right), move it left.
if (xCoord + (text.length() * 7) >= getWidth()) {

@ -67,8 +67,8 @@ public class GPSConverter {
//Calculate the x and y pixel coordinates.
//We take the complement of latProportion to flip it.
int x = (int) (longProportion * smallerDimension);
int y = (int) (latProportion * smallerDimension);
double x = (longProportion * smallerDimension);
double y = (latProportion * smallerDimension);
//Because we try to maintain the correct aspect ratio, we will end up with "spare" pixels along the larger dimension (e.g., width 800, height 600, 200 extra pixels along width).
double extraDistance = Math.abs(longitudeFactor - latitudeFactor);

Loading…
Cancel
Save