camel case
This commit is contained in:
@@ -5,15 +5,15 @@ import org.joml.Vector2f;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
|
|
||||||
class DDDPlacement {
|
class DDDPlacement {
|
||||||
public static Vector2f coordinates_to_vector(Coordinate coo) {
|
public static Vector2f coordinatesToVector(Coordinate coo) {
|
||||||
return coordinates_to_vector(coo.getX(), coo.getY());
|
return coordinatesToVector(coo.getX(), coo.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2f coordinates_to_vector(float x, float y) {
|
public static Vector2f coordinatesToVector(float x, float y) {
|
||||||
return new Vector2f(1.0f - 0.125f - x * 0.250f, 1.0f - 0.125f - y * 0.250f);
|
return new Vector2f(1.0f - 0.125f - x * 0.250f, 1.0f - 0.125f - y * 0.250f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Coordinate vector_to_coordinates(Vector2f pos) {
|
public static Coordinate vectorToCoordinates(Vector2f pos) {
|
||||||
int x = (int) ((1.0f - pos.x) * 4.0f);
|
int x = (int) ((1.0f - pos.x) * 4.0f);
|
||||||
int y = (int) ((1.0f - pos.y) * 4.0f);
|
int y = (int) ((1.0f - pos.y) * 4.0f);
|
||||||
return new Coordinate(x, y);
|
return new Coordinate(x, y);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class DDDView extends GameAdaptator {
|
|||||||
if (piece == null)
|
if (piece == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Vector2f pieceBoardPos = DDDPlacement.coordinates_to_vector(pos);
|
Vector2f pieceBoardPos = DDDPlacement.coordinatesToVector(pos);
|
||||||
Vector3f pieceWorldPos = new Vector3f(pieceBoardPos.x(), 0, pieceBoardPos.y());
|
Vector3f pieceWorldPos = new Vector3f(pieceBoardPos.x(), 0, pieceBoardPos.y());
|
||||||
|
|
||||||
PieceEntity entity = new PieceEntity(piece, pieceWorldPos,
|
PieceEntity entity = new PieceEntity(piece, pieceWorldPos,
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class Window {
|
|||||||
double y[] = new double[1];
|
double y[] = new double[1];
|
||||||
glfwGetCursorPos(this.window, x, y);
|
glfwGetCursorPos(this.window, x, y);
|
||||||
Vector2f cursorPos = this.cam.getCursorWorldFloorPos(new Vector2f((float) x[0], (float) y[0]), windowWidth, windowHeight);
|
Vector2f cursorPos = this.cam.getCursorWorldFloorPos(new Vector2f((float) x[0], (float) y[0]), windowWidth, windowHeight);
|
||||||
Coordinate selectedCell = DDDPlacement.vector_to_coordinates(cursorPos);
|
Coordinate selectedCell = DDDPlacement.vectorToCoordinates(cursorPos);
|
||||||
if (this.lastCell == null) {
|
if (this.lastCell == null) {
|
||||||
this.lastCell = selectedCell;
|
this.lastCell = selectedCell;
|
||||||
if (selectedCell.isValid())
|
if (selectedCell.isValid())
|
||||||
|
|||||||
Reference in New Issue
Block a user