package entities;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Array;
import com.ld50.game.HF;

import Global.Global;
import u.Uinput;
import u.UsefulMethods;

public class PausePerson extends Sprite {
	public enum State {
		MAIN
	};

	public State currentState;
	public State previousState;
	private Animation<TextureRegion> main;
	private float _animBreakingTimer;
	// private Animation<TextureRegion> walkLeft;
	// private Animation<TextureRegion> walkUp;
	// private Animation<TextureRegion> walkDown;
	// maybe just keep a simple ball that animates or something. Animated would definitely be a rec
	// private Texture ppTexture;
	// private TextureRegion ppRegion;
	private TextureAtlas atlasPP;
	private boolean isMain = true;// is the animation set to main
	public Color color;
	public Float speed;
	public Rectangle rect;
	public Rectangle saveGameRect;
	public Rectangle loadGameRect;
	public Rectangle muteSoundRect;
	public Rectangle muteMusicRect;
	public Rectangle keyBindingsRect;
	public Rectangle backRect;
	public Rectangle exitGameRect;
	public Rectangle crouchRect;
	public Rectangle sprintRect;
	public Rectangle keyBindingsBackRect;
	public boolean IsSwitchingToKeyBindings;
	public boolean isLeftKey;
	public boolean isRightKey;
	public boolean isUpKey;
	public boolean isDownKey;
	public boolean isFireKey;
	public boolean isJumpKey;
	public boolean isInventoryKey;
	public boolean isCrouchKey;
	public boolean isSprintKey;
	private int _sw;// sprite width
	private int _sh;// sprite height
	protected int MoveBufferX = 0, MoveBufferY = 0;
	private boolean dark;
	private float fadeTimer;
	// sfx
	private Sound moveUp;
	private Sound moveDown;
	private Sound moveRight;
	private Sound moveLeft;
	private Sound select;
	private Sound back;
	private Sound changeKey;
	/// <summary> //i have no idea if this translates. This is from another collider program because i can't invent this stuff a bizzilions times
	/// Determines how many units represent 1 pixel. Default is 100. Example: A speed of 100 would
	/// move the object 1 pixel per update.
	/// </summary>
	public int SpeedScale = 100;// this... um. did nothing hehehehahahhaha
	public boolean IsBiPolar;

	public PausePerson(float _x, float _y) {
		rect = new Rectangle();
		rect.x = _x;
		rect.y = _y;
		rect.width = 50;
		rect.height = 50;

		// add menu rectangles. :O
		saveGameRect = new Rectangle(300, 480, 600, 50);
		loadGameRect = new Rectangle(300, 430, 600, 50);
		muteSoundRect = new Rectangle(300, 380, 600, 50);
		muteMusicRect = new Rectangle(300, 330, 600, 50);
		keyBindingsRect = new Rectangle(300, 280, 600, 50);
		backRect = new Rectangle(300, 230, 600, 50);
		exitGameRect = new Rectangle(300, 180, 600, 50);
		crouchRect = new Rectangle(300, 130, 600, 50);
		sprintRect = new Rectangle(300, 80, 600, 50);
		keyBindingsBackRect = new Rectangle(300, 30, 600, 50);

		_sw = 50;
		_sh = 50;
		// this is for the animations
		currentState = State.MAIN;
		previousState = State.MAIN;
		_animBreakingTimer = 0f;
		speed = 50f;// how fast the goes//not sure here.
		// sounds
		moveUp = Gdx.audio.newSound(Gdx.files.internal("sfx/moveUp.ogg"));
		moveDown = Gdx.audio.newSound(Gdx.files.internal("sfx/moveDown.ogg"));
		moveRight = Gdx.audio.newSound(Gdx.files.internal("sfx/moveRight.ogg"));
		moveLeft = Gdx.audio.newSound(Gdx.files.internal("sfx/moveLeft.ogg"));
		select = Gdx.audio.newSound(Gdx.files.internal("sfx/select.ogg"));
		back = Gdx.audio.newSound(Gdx.files.internal("sfx/back.ogg"));
		changeKey = Gdx.audio.newSound(Gdx.files.internal("sfx/changeKey.ogg"));
		// get pause person atlas
		atlasPP = new TextureAtlas(Gdx.files.internal("pausePerson.txt"));
		// animated frames
		Array<TextureRegion> frames = new Array<TextureRegion>();
		frames.add(new TextureRegion(atlasPP.findRegion("pausePerson"), (0 * _sw), (0 * _sh), _sw, _sh));
		frames.add(new TextureRegion(atlasPP.findRegion("pausePerson"), (1 * _sw), (0 * _sh), _sw, _sh));
		frames.add(new TextureRegion(atlasPP.findRegion("pausePerson"), (2 * _sw), (0 * _sh), _sw, _sh));
		frames.add(new TextureRegion(atlasPP.findRegion("pausePerson"), (1 * _sw), (0 * _sh), _sw, _sh));
		main = new Animation<TextureRegion>(.05f, frames, PlayMode.LOOP);// was .06f
		frames.clear();// definitely starts right. then we say, when the line is one length + one _sw worth which would be what in actual numbers?
		// these two are specifically sprite settings to set the sprite's initial bounds and region
		// assign random color
		color = new Color(new Color(MathUtils.random(0), MathUtils.random(0), MathUtils.random(.8f, 1f), 1));
		setBounds(0, 0, _sw, _sh);
		setOriginCenter();
		setRegion(main.getKeyFrame(_animBreakingTimer, true));
	}

	// for all the animations: //this isn't even updated unless i call it from the other screen oh bother. *facepalm*
	public void Update(float dt, OrthographicCamera camera) {
		handleInput(dt, camera);
		Global.P = rect;
	}

	// for all the animations: //this isn't even updated unless i call it from the other screen oh bother. *facepalm*
	public TextureRegion getFrame(float dt, OrthographicCamera camera) {
		Update(dt, camera);

		currentState = getState();

		TextureRegion region;
		switch (currentState) {
		case MAIN:
			region = main.getKeyFrame(_animBreakingTimer, true);
			break;
		default:
			region = main.getKeyFrame(_animBreakingTimer, false);
			break;
		}
		if (isMain)
			_animBreakingTimer += dt;
		else
			_animBreakingTimer = 0;

		return region;
	}

	public State getState() {
		if (isMain)
			return State.MAIN;
		else
			return State.MAIN;
	}

	private void handleInput(float dt, OrthographicCamera camera) {
		// input controls
		boolean isCT = false;
		if (Gdx.input.isKeyJustPressed(Uinput.Right())) {
			// System.out.println("right: " + rect.x + " MW: " + HF.MW);
			isCT = rect.x > HF.MW - _sw ? true : false;// right
			MoveRight(speed, isCT, dt);
			if (!Global.SetVolumeToZero)
				moveRight.play(2f);
		}
		if (Gdx.input.isKeyJustPressed(Uinput.Left())) {
			// System.out.println("left: " + rect.x + " MW: " + HF.MW);
			isCT = rect.x < -5 ? true : false; // left
			MoveLeft(speed, isCT, dt);
			if (!Global.SetVolumeToZero)
				moveLeft.play(2f);
		}

		if (Gdx.input.isKeyJustPressed(Uinput.Up())) {
			// System.out.println("up: " + rect.y + " MH: " + HF.MH);
			isCT = rect.y > HF.MH - _sh ? true : false;// down
			MoveUp(speed, isCT, dt);
			if (!Global.SetVolumeToZero)
				moveUp.play(2f);
		}
		if (Gdx.input.isKeyJustPressed(Uinput.Down())) {
			// System.out.println("down: " + rect.y + " MH: " + HF.MH);
			isCT = rect.y < -5 ? true : false;// up
			MoveDown(speed, isCT, dt);
			if (!Global.SetVolumeToZero)
				moveDown.play(2f);
		}
		// i'm putting this here for now TESTING the idea is solid, but it needs to go in the right place to work properly.
		// The entire display needs to change and that's on the screen
		if (rect.y == 480 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(saveGameRect, camera)) {
			if (!Global.SetVolumeToZero)
				select.play(2f);
		} else if (rect.y == 430 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(loadGameRect, camera)) {
			if (!Global.SetVolumeToZero)
				select.play(2f);
		} else if (rect.y == 380 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(muteSoundRect, camera)) {
			if (!Global.SetVolumeToZero)
				select.play(2f);
			if (Global.SetVolumeToZero) {
				Global.SetVolumeToZero = false;
				HF.GameSettings.putBoolean("isSoundMuted", false);
				HF.GameSettings.flush();
			} else {
				Global.SetVolumeToZero = true;
				HF.GameSettings.putBoolean("isSoundMuted", true);
				HF.GameSettings.flush();
			}
		} else if (rect.y == 330 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(muteMusicRect, camera)) {
			if (!Global.SetVolumeToZero)
				select.play(2f);
			if (Global.IsMusicPaused) {
				Global.IsMusicPaused = false;
				HF.GameSettings.putBoolean("isMusicPaused", false);
				HF.GameSettings.flush();
			} else {
				Global.IsMusicPaused = true;
				HF.GameSettings.putBoolean("isMusicPaused", true);
				HF.GameSettings.flush();
			}
		} else if (rect.y == 280 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
				&& !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(keyBindingsRect, camera)) {
			if (!Global.SetVolumeToZero)
				select.play(2f);
			Global.IsKeyBindings = true;
			rect.y = 480;
		} else if (rect.y == 230 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(backRect, camera)) {
			if (!Global.SetVolumeToZero)
				back.play(2f);
			Global.IsPaused = false;
		} else if (rect.y == 180 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && !Global.IsKeyBindings
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && !Global.IsKeyBindings && UsefulMethods.IsMouseInsideRectangle(exitGameRect, camera)) {
			if (!Global.SetVolumeToZero)
				select.play(2f);
			Gdx.app.exit();
		} else if (rect.y == 480 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(saveGameRect, camera)) {
			Global.IsSetKey = true;
			isLeftKey = true;
		} else if (rect.y == 430 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(loadGameRect, camera)) {
			Global.IsSetKey = true;
			isRightKey = true;
		} else if (rect.y == 380 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(muteSoundRect, camera)) {
			Global.IsSetKey = true;
			isUpKey = true;
		} else if (rect.y == 330 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(muteMusicRect, camera)) {
			Global.IsSetKey = true;
			isDownKey = true;
		} else if (rect.y == 280 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(keyBindingsRect, camera)) {
			Global.IsSetKey = true;
			isFireKey = true;
		} else if (rect.y == 230 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(backRect, camera)) {
			Global.IsSetKey = true;
			isJumpKey = true;
		} else if (rect.y == 180 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(exitGameRect, camera)) {
			Global.IsSetKey = true;
			isInventoryKey = true;
		} else if (rect.y == 130 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(crouchRect, camera)) {
			Global.IsSetKey = true;
			isCrouchKey = true;
		} else if (rect.y == 80 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(sprintRect, camera)) {
			Global.IsSetKey = true;
			isSprintKey = true;
		} else if (rect.y == 30 && Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && Global.IsKeyBindings && !Global.IsSetKey
				|| Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && Global.IsKeyBindings && !Global.IsSetKey
						&& UsefulMethods.IsMouseInsideRectangle(keyBindingsBackRect, camera)) {
			Global.IsKeyBindings = false;
			if (!Global.SetVolumeToZero)
				back.play(2f);
			rect.y = 280;
		} else if (isLeftKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("left_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isLeftKey = false;
			}
		} else if (isRightKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("right_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isRightKey = false;
			}
		} else if (isUpKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("up_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isUpKey = false;
			}
		} else if (isDownKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("down_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isDownKey = false;
			}
		} else if (isFireKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("fire_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isFireKey = false;
			}
		} else if (isJumpKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("jump_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isJumpKey = false;
			}
		} else if (isInventoryKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("inventory_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isInventoryKey = false;
			}
		} else if (isCrouchKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("crouch_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isCrouchKey = false;
			}
		} else if (isSprintKey) {
			if (Gdx.input.isKeyJustPressed(Input.Keys.ANY_KEY) || Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)
					|| Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) {
				HF.GameSettings.putInteger("sprint_key", Global.KeycodeSet);
				HF.GameSettings.flush();
				Uinput.LoadDefaultInputs();
				if (!Global.SetVolumeToZero)
					changeKey.play(2f);
				Global.IsSetKey = false;
				isSprintKey = false;
			}
		}
		if (Global.IsSetKey && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
			isLeftKey = false;
			isRightKey = false;
			isUpKey = false;
			isDownKey = false;
			isFireKey = false;
			isJumpKey = false;
			isInventoryKey = false;
			isCrouchKey = false;
			isSprintKey = false;
		} else if (IsSwitchingToKeyBindings) {
			IsSwitchingToKeyBindings = false;
			rect.y = 280;
		} else if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
			rect.y = 480;
		}
	}

	public void MoveRight(float speed, boolean isColl, float dt) {
		if (isColl)
			rect.x += 0;
		else
			rect.x += 0;// was speed. trying without * dt
	}

	public void MoveLeft(float speed, boolean isColl, float dt) {
		// test this:
		if (isColl)
			rect.x -= 0;
		else
			rect.x -= 0;// was speed
	}

	public void MoveUp(float speed, boolean isColl, float dt) {
		if (isColl)
			rect.y += 0;
		else
			rect.y += speed;
		// this is after the move. See if it's too far, if so adjust.
		if (Global.IsKeyBindings && rect.y > 480)
			rect.y = 30;
		else if (rect.y > 480)
			rect.y = 180;
	}

	public void MoveDown(float speed, boolean isColl, float dt) {
		if (isColl)
			rect.y -= 0;
		else
			rect.y -= speed;
		// this is after the move. See if it's too far, if so adjust.
		if (Global.IsKeyBindings && rect.y < 30)
			rect.y = 480;
		else if (!Global.IsKeyBindings && rect.y < 180)
			rect.y = 480;
	}

	public void RenderEntirePauseMenu(float dt, HF game, BitmapFont font, Music rainMusic, OrthographicCamera camera) {
		// the timer needs to run before you set it.
		if (fadeTimer <= .2f)
			dark = true;
		else if (fadeTimer >= 1)
			dark = false;
		if (dark)
			fadeTimer += .02f;
		else
			fadeTimer -= .02f;
		font.setColor(3f, 1f, 3f, fadeTimer);
		font.draw(game.batch, "Game is paused", Gdx.graphics.getWidth() * .4f, Gdx.graphics.getHeight() * .85f);
		if (Global.IsKeyBindings) {
			if (Global.IsSetKey) {
				font.draw(game.batch, "Please Press Any Key To Set Key", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 200f);
				font.draw(game.batch, ":-)", Gdx.graphics.getWidth() - 350f, Gdx.graphics.getHeight() - 250f);
			} else {
				if (UsefulMethods.IsMouseInsideRectangle(saveGameRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 480)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Left", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 200f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Left()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 200f);
				if (UsefulMethods.IsMouseInsideRectangle(loadGameRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 430)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Right", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 250f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Right()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 250f);
				if (UsefulMethods.IsMouseInsideRectangle(muteSoundRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 380)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Up", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 300f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Up()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 300f);
				if (UsefulMethods.IsMouseInsideRectangle(muteMusicRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 330)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Down", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 350f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Down()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 350f);
				if (UsefulMethods.IsMouseInsideRectangle(keyBindingsRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 280)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Fire", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 400f);
				String fireText = "";
				if (Uinput.Fire() == 0)
					fireText = "mouse button left";
				else
					fireText = Input.Keys.toString(Uinput.Fire());
				font.draw(game.batch, "" + fireText, Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 400f);
				if (UsefulMethods.IsMouseInsideRectangle(backRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 230)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Jump", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 450f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Jump()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 450f);
				if (UsefulMethods.IsMouseInsideRectangle(exitGameRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 180)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Inventory", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 500f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Inventory()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 500f);
				if (UsefulMethods.IsMouseInsideRectangle(crouchRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 130)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Crouch", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 550f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Crouch()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 550f);
				if (UsefulMethods.IsMouseInsideRectangle(sprintRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 80)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Sprint", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 600f);
				font.draw(game.batch, "" + Input.Keys.toString(Uinput.Sprint()), Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 600f);
				if (UsefulMethods.IsMouseInsideRectangle(keyBindingsBackRect, camera))
					font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
				else if (rect.y == 30)
					font.setColor(fadeTimer, fadeTimer, 1f, 1f);
				else
					font.setColor(1f, 1f, 1f, 1f);
				font.draw(game.batch, "Back", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 650f);
				font.draw(game.batch, "You know, go back to the pause screen", Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 650f);
			}
		} else {
			font.setColor(3f, 1f, 3f, fadeTimer);
			font.draw(game.batch, "Game is paused", Gdx.graphics.getWidth() * .4f, Gdx.graphics.getHeight() * .85f);
			if (UsefulMethods.IsMouseInsideRectangle(saveGameRect, camera))
				font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
			else if (rect.y == 480)
				font.setColor(fadeTimer, fadeTimer, 1f, .5f);// testing when implemented, set it back to 1f for the alpha.
			else
				font.setColor(.5f, .5f, .5f, 1f);// testing when implemented, set it back to 1f for each.
			font.draw(game.batch, "Save Game", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 200f);
			if (UsefulMethods.IsMouseInsideRectangle(loadGameRect, camera))
				font.setColor(fadeTimer, 1f, .5f, .5f);// testing when implemented, set it back to 1f for the alpha.
			else if (rect.y == 430)
				font.setColor(fadeTimer, fadeTimer, 1f, .5f);// testing when implemented, set it back to 1f for the alpha.
			else
				font.setColor(.5f, .5f, .5f, 1f);// testing when implemented, set it back to 1f for each.
			font.draw(game.batch, "Load Game", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 250f);
			if (UsefulMethods.IsMouseInsideRectangle(muteSoundRect, camera))
				font.setColor(fadeTimer, 1f, .5f, 1f);
			else if (rect.y == 380)
				font.setColor(fadeTimer, fadeTimer, 1f, 1f);
			else
				font.setColor(1f, 1f, 1f, 1f);
			font.draw(game.batch, "Mute Sound", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 300f);
			if (Global.SetVolumeToZero) {
				font.draw(game.batch, "[X]", Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 300f);
			} else {
				font.draw(game.batch, "[ ]", Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 300f);
			}
			if (UsefulMethods.IsMouseInsideRectangle(muteMusicRect, camera))
				font.setColor(fadeTimer, 1f, .5f, 1f);
			else if (rect.y == 330)
				font.setColor(fadeTimer, fadeTimer, 1f, 1f);
			else
				font.setColor(1f, 1f, 1f, 1f);
			font.draw(game.batch, "Mute Music", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 350f);
			if (Global.IsMusicPaused) {
				rainMusic.pause();
				font.draw(game.batch, "[X]", Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 350f);
			} else {
				rainMusic.play();
				font.draw(game.batch, "[ ]", Gdx.graphics.getWidth() - 750f, Gdx.graphics.getHeight() - 350f);
			}
			if (UsefulMethods.IsMouseInsideRectangle(keyBindingsRect, camera))
				font.setColor(fadeTimer, 1f, .5f, 1f);
			else if (rect.y == 280)
				font.setColor(fadeTimer, fadeTimer, 1f, 1f);
			else
				font.setColor(1f, 1f, 1f, 1f);
			font.draw(game.batch, "Key Bindings", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 400f);
			if (UsefulMethods.IsMouseInsideRectangle(backRect, camera))
				font.setColor(fadeTimer, 1f, .5f, 1f);
			else if (rect.y == 230)
				font.setColor(fadeTimer, fadeTimer, 1f, 1f);
			else
				font.setColor(1f, 1f, 1f, 1f);
			font.draw(game.batch, "Back", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 450f);
			if (UsefulMethods.IsMouseInsideRectangle(exitGameRect, camera))
				font.setColor(fadeTimer, 1f, .5f, 1f);
			else if (rect.y == 180)
				font.setColor(fadeTimer, fadeTimer, 1f, 1f);
			else
				font.setColor(1f, 1f, 1f, 1f);
			font.draw(game.batch, "Stab Game and it Dies", Gdx.graphics.getWidth() - 950f, Gdx.graphics.getHeight() - 500f);
		}
		// the pause person actor should be able to be used now to move up and down the menu and navigate the menu. Or if mouse interaction is fine, use
		// that.
		game.batch.setColor(color);
		game.batch.draw(getFrame(dt, camera), rect.x + fadeTimer, rect.y);
		game.batch.end();

	}
}
