aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpacien2018-01-12 00:14:53 +0100
committerpacien2018-01-12 00:14:53 +0100
commit4e7a2210c94589cd9a5370497d8a28f5ba487c54 (patch)
treeebbb8ffe0c912f4975c07e9c070f824dab612302 /src
parent6760ddb7a47b96dae5b1b626417dcf3cbd4055b1 (diff)
downloadwallj-4e7a2210c94589cd9a5370497d8a28f5ba487c54.tar.gz
Fix coordinate inversion
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/fr/umlv/java/wallj/board/TileVec2.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/board/TileVec2.java b/src/main/java/fr/umlv/java/wallj/board/TileVec2.java
index 60a2b75..b00c044 100644
--- a/src/main/java/fr/umlv/java/wallj/board/TileVec2.java
+++ b/src/main/java/fr/umlv/java/wallj/board/TileVec2.java
@@ -14,12 +14,12 @@ public final class TileVec2 {
14 private static final int TILE_DIM = 20; 14 private static final int TILE_DIM = 20;
15 15
16 /** 16 /**
17 * @param row the row
18 * @param col the column 17 * @param col the column
18 * @param row the row
19 * @return a corresponding tile vector 19 * @return a corresponding tile vector
20 */ 20 */
21 public static TileVec2 of(int row, int col) { 21 public static TileVec2 of(int col, int row) {
22 return new TileVec2(row, col); 22 return new TileVec2(col, row);
23 } 23 }
24 24
25 /** 25 /**
@@ -30,32 +30,32 @@ public final class TileVec2 {
30 return new TileVec2((int) (v.x / TILE_DIM), (int) (v.y / TILE_DIM)); 30 return new TileVec2((int) (v.x / TILE_DIM), (int) (v.y / TILE_DIM));
31 } 31 }
32 32
33 private final int row, col; 33 private final int col, row;
34 34
35 private TileVec2(int row, int col) { 35 private TileVec2(int col, int row) {
36 this.row = row;
37 this.col = col; 36 this.col = col;
37 this.row = row;
38 } 38 }
39 39
40 /** 40 /**
41 * @return the row 41 * @return the column
42 */ 42 */
43 public int getRow() { 43 public int getCol() {
44 return row; 44 return col;
45 } 45 }
46 46
47 /** 47 /**
48 * @return the column 48 * @return the row
49 */ 49 */
50 public int getCol() { 50 public int getRow() {
51 return col; 51 return row;
52 } 52 }
53 53
54 /** 54 /**
55 * @return the corresponding JBox2D coordinates of the top-left corner of the tile 55 * @return the corresponding JBox2D coordinates of the top-left corner of the tile
56 */ 56 */
57 public Vec2 toVec2() { 57 public Vec2 toVec2() {
58 return new Vec2(row * TILE_DIM, col * TILE_DIM); 58 return new Vec2(col * TILE_DIM, row * TILE_DIM);
59 } 59 }
60 60
61 @Override 61 @Override
@@ -63,20 +63,20 @@ public final class TileVec2 {
63 if (this == o) return true; 63 if (this == o) return true;
64 if (!(o instanceof TileVec2)) return false; 64 if (!(o instanceof TileVec2)) return false;
65 TileVec2 tileVec2 = (TileVec2) o; 65 TileVec2 tileVec2 = (TileVec2) o;
66 return row == tileVec2.row && 66 return col == tileVec2.col &&
67 col == tileVec2.col; 67 row == tileVec2.row;
68 } 68 }
69 69
70 @Override 70 @Override
71 public int hashCode() { 71 public int hashCode() {
72 return Objects.hash(row, col); 72 return Objects.hash(col, row);
73 } 73 }
74 74
75 @Override 75 @Override
76 public String toString() { 76 public String toString() {
77 return "TileVec2{" + 77 return "TileVec2{" +
78 "row=" + row + 78 "col=" + col +
79 ", col=" + col + 79 ", row=" + row +
80 '}'; 80 '}';
81 } 81 }
82 82