dev #12

Merged
Persson-dev merged 44 commits from dev into main 2025-05-17 15:05:24 +00:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 0fb24263e0 - Show all commits

View File

@@ -5,15 +5,15 @@ import org.joml.Vector2f;
import chess.model.Coordinate;
class DDDPlacement {
public static Vector2f coordinates_to_vector(Coordinate coo) {
return coordinates_to_vector(coo.getX(), coo.getY());
public static Vector2f coordinatesToVector(Coordinate coo) {
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);
}
public static Coordinate vector_to_coordinates(Vector2f pos) {
public static Coordinate vectorToCoordinates(Vector2f pos) {
int x = (int) ((1.0f - pos.x) * 4.0f);
int y = (int) ((1.0f - pos.y) * 4.0f);
return new Coordinate(x, y);

View File

@@ -87,7 +87,7 @@ public class DDDView extends GameAdaptator {
if (piece == null)
continue;
Vector2f pieceBoardPos = DDDPlacement.coordinates_to_vector(pos);
Vector2f pieceBoardPos = DDDPlacement.coordinatesToVector(pos);
Vector3f pieceWorldPos = new Vector3f(pieceBoardPos.x(), 0, pieceBoardPos.y());
PieceEntity entity = new PieceEntity(piece, pieceWorldPos,

View File

@@ -151,7 +151,7 @@ public class Window {
double y[] = new double[1];
glfwGetCursorPos(this.window, x, y);
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) {
this.lastCell = selectedCell;
if (selectedCell.isValid())