package engine;

import player.Player;

/**  ------------- Nihilne ------------
    *** @author Mitch Weaver - 2016 ***
      ~~~~ All Rights Reserved ~~~~ */

public final class Camera {

	public static double x, y;
	
	public final static void tick() {
		switch(Game.rotation) {
			case 1: 
				x = -Player.center.x + Game.WIDTH / 2 / Game.scaleFactor;
				y = -Player.center.y + Game.HEIGHT / 2 / Game.scaleFactor; break;
			case 2:
				if (((float) Game.WIDTH / Game.HEIGHT) >= (16.0f / 9)) {
					x = -Player.center.x + Game.WIDTH / 1.81f / Game.scaleFactor;
					y = -Player.center.y - Game.HEIGHT / 3.65f / Game.scaleFactor;
				} else if ((Game.WIDTH / Game.HEIGHT) <= (4.0f / 3)) {
					x = -Player.center.x + Game.WIDTH / 1.62f / Game.scaleFactor;
					y = -Player.center.y - Game.HEIGHT / 8.25f / Game.scaleFactor;
				} break;
			case 3:
				if (((float) Game.WIDTH / Game.HEIGHT) >= (16.0f / 9)) {
					x = -Player.center.x + Game.WIDTH / 3.54f / Game.scaleFactor;
					y = -Player.center.y - Game.HEIGHT / 1.125f / Game.scaleFactor;
				} else if ((Game.WIDTH / Game.HEIGHT) <= (4.0f / 3)) {
					x = -Player.center.x + Game.WIDTH / 2.675f / Game.scaleFactor;
					y = -Player.center.y - Game.HEIGHT / 1.5f / Game.scaleFactor;
				} break;
			case 4:
				if (((float) Game.WIDTH / Game.HEIGHT) >= (16.0f / 9)) {
					x = -Player.center.x - Game.WIDTH / 6.55f / Game.scaleFactor;
					y = -Player.center.y - Game.HEIGHT / 1.015f / Game.scaleFactor;
				} else if ((Game.WIDTH / Game.HEIGHT) <= (4.0f / 3)) {
					x = -Player.center.x - Game.WIDTH / 11.4f / Game.scaleFactor;
					y = -Player.center.y - Game.HEIGHT / 1.21f / Game.scaleFactor;
				} break;
			case 5:
				x = -Player.center.x - Game.WIDTH / 2 / Game.scaleFactor;
				y = -Player.center.y - Game.HEIGHT / 2 / Game.scaleFactor; break;
			case 6:
				if (((float) Game.WIDTH / Game.HEIGHT) >= (16.0f / 9)) {
					x = -Player.center.x - Game.WIDTH / 1.81f / Game.scaleFactor;
					y = -Player.center.y + Game.HEIGHT / 3.65f / Game.scaleFactor;
				} else if ((double) (Game.WIDTH / Game.HEIGHT) <= (4.0f / 3)) {
					x = -Player.center.x - Game.WIDTH / 1.62f / Game.scaleFactor;
					y = -Player.center.y + Game.HEIGHT / 8.25f / Game.scaleFactor;
				} break;
			case 7:
				if (((float) Game.WIDTH / Game.HEIGHT) >= (16.0f / 9)) {
					x = -Player.center.x - Game.WIDTH / 3.55f / Game.scaleFactor;
					y = -Player.center.y + Game.HEIGHT / 1.125f / Game.scaleFactor;
				} else if ((double) (Game.WIDTH / Game.HEIGHT) <= (4.0f / 3)) {
					x = -Player.center.x - Game.WIDTH / 2.675f / Game.scaleFactor;
					y = -Player.center.y + Game.HEIGHT / 1.5f / Game.scaleFactor;
				} break;
			case 8:
				if (((float) Game.WIDTH / Game.HEIGHT) >= (16.0f / 9)) {
					x = -Player.center.x + Game.WIDTH / 6.55f / Game.scaleFactor;
					y = -Player.center.y + Game.HEIGHT / 1.015f / Game.scaleFactor;
				} else if ((double) (Game.WIDTH / Game.HEIGHT) <= (4.0f / 3)) {
					x = -Player.center.x + Game.WIDTH / 11.4f / Game.scaleFactor;
					y = -Player.center.y + Game.HEIGHT / 1.21f / Game.scaleFactor;
				} break;
		}
	}
}
