raycast cursor
This commit is contained in:
@@ -5,12 +5,17 @@ import org.joml.Vector2f;
|
||||
import chess.model.Coordinate;
|
||||
|
||||
class DDDPlacement {
|
||||
static public Vector2f coordinates_to_vector(Coordinate coo) {
|
||||
public static Vector2f coordinates_to_vector(Coordinate coo) {
|
||||
return coordinates_to_vector(coo.getX(), coo.getY());
|
||||
}
|
||||
|
||||
static public Vector2f coordinates_to_vector(float x, float y) {
|
||||
public static Vector2f coordinates_to_vector(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) {
|
||||
int x = (int) ((1.0f - pos.x) * 4.0f);
|
||||
int y = (int) ((1.0f - pos.y) * 4.0f);
|
||||
return new Coordinate(x, y);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user