package eu.midnightdust.yaytris.util;

public class Vec2i {
    private final int x;
    private final int y;

    Vec2i(int x, int y) {
        this.x = x;
        this.y = y;
    }

    /**
     * Creates a vector holding two signed ints.
     *
     * @param x     the x value
     * @param y     the y value
     */
    public static Vec2i of(int x, int y) {
        return new Vec2i(x, y);
    }

    /**
     * @return the saved x value
     */
    public int getX() {
        return x;
    }

    /**
     * @return the saved y value
     */
    public int getY() {
        return y;
    }

    /**
     * Offset each coordinate of this vector by the same coordinate of another vector
     *
     * @param other   the vector to add
     * @return        the sum of both vectors
     */
    public Vec2i offset(Vec2i other) {
        return new Vec2i(x + other.getX(), y + other.getY());
    }
}
