Changed GraphCoordinate to use double instead of int.

This results in waaaaay smoother movement. Boats no longer jump around.
This commit is contained in:
fjc40
2017-09-15 01:34:32 +12:00
parent 97aa917403
commit 2c92102b2a
3 changed files with 9 additions and 9 deletions
@@ -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()) {