package u;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;

public class UsefulMethods {

	public UsefulMethods() {
	}

	public static boolean IsMouseInsideRectangle(Rectangle r, OrthographicCamera camera) {
		Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
		camera.unproject(touchPos);

		if (r.contains(touchPos.x, touchPos.y))
			return true;
		else
			return false;
	}

	public static int MoveCameraAroundRandomly(OrthographicCamera camera) {
		MoveCameraAroundRandomly(camera, 4, 5);
		return 0;
	}

	public static void MoveCameraAroundRandomly(OrthographicCamera camera, int minJitter, int maxJitter) {
		int randomDir = MathUtils.random(0, 4);// 0-8, should yield 4 directions... It doesn't seem to.... :O
		int _minJitter = minJitter;
		int _maxJitter = maxJitter;
		if (randomDir == 0)
			camera.position.x += MathUtils.random(_minJitter, _maxJitter);
		else if (randomDir == 1)
			camera.position.x -= MathUtils.random(_minJitter, _maxJitter);
		else if (randomDir == 2)
			camera.position.y += MathUtils.random(_minJitter, _maxJitter);
		else if (randomDir == 3)
			camera.position.y -= MathUtils.random(_minJitter, _maxJitter);
		else if (randomDir == 4) {
			camera.position.x += MathUtils.random(_minJitter, _maxJitter);
			camera.position.y += MathUtils.random(_minJitter, _maxJitter);
		} else {// this is 6 directional options? Man, what kind of camera random mover are you? haha
			camera.position.x += MathUtils.random(_minJitter, _maxJitter);
			camera.position.y -= MathUtils.random(_minJitter, _maxJitter);
		}
	}

}
