package com.ld58.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;

import Global.Global;
import entities.PausePerson;

public class TitleScreen implements Screen {
	final rcr game;
	private OrthographicCamera camera;
	private Viewport vport;
	// add pause person. This is added to every screen in the game. ty.
	private PausePerson pp;
	private Sound enter;
	private Sound enter2;
	private Music chillMusic;
	// end pause variables
	private float cameraInitX;
	private float cameraInitY;
	private boolean isCameraPositionInitialized;
	private int cameraShakeTimer;
	private Sound thump;
	private Sound sfx_titlescreen;
	private float timer = .02f;
	private float timer2 = .2f;
	private boolean up;
	private boolean up2;
	private float angle = 1f;
	private float widthX;
	private float heightY;
	private float angle2 = 60f;
	private float widthX2;
	private float heightY2;
	private float angle3 = 120f;
	private float widthX3;
	private float heightY3;
	private float angle4 = 180f;
	private float widthX4;
	private float heightY4;
	private float angle5 = 240f;
	private float widthX5;
	private float heightY5;
	private float angle6 = 300f;
	private float widthX6;
	private float heightY6;
	private float nameZoomX = 16f;
	private float nameZoomY = 16f;
	private float textLeft = 16f;
	private float textLeft2 = 16f;
	private float textLeft3 = 16f;
	private float textLeft4 = 16f;
	private float textLeft5 = 16f;
	private float textLeft6 = 16f;
	private float textLeft7 = 16f;
	private float textLeft8 = 16f;
	private float textX = 116f;
	private float textX2 = -216f;
	private float textX3 = -316f;
	private float textX4 = -416f;
	private float textX5 = -116f;
	private float textX6 = -116f;
	private float textX7 = -116f;
	private float textX8 = -116f;
	private boolean isNameZoomRight;
	private boolean isNameZoomUp;
	private float timer3;
	private float upLocation;
	private Vector3 mousePos;
	private float widthMouse;
	private float heightMouse;
	private float angle7 = 60f;
	private float textLeftSpeed;
	private float textLeftSpeed2;
	private float textLeftSpeed3;
	private float textLeftSpeed4;
	private float textLeftSpeed5;
	private float textLeftSpeed6;
	private float textLeftSpeed7;
	private float textLeftSpeed8;

	// font title? yeah! (later)
	public TitleScreen(final rcr game) {
		this.game = game;
		camera = new OrthographicCamera();
		vport = new FitViewport(rcr.MW, rcr.MH, camera);
		sfx_titlescreen = Gdx.audio.newSound(Gdx.files.internal("sfx/select.ogg"));
		// menustuff:
		pp = new PausePerson(Gdx.graphics.getWidth() / 2 - 210, Gdx.graphics.getHeight() - 235f);
		enter = Gdx.audio.newSound(Gdx.files.internal("sfx/click.ogg"));
		enter2 = Gdx.audio.newSound(Gdx.files.internal("sfx/click2.ogg"));
		// music
		chillMusic = Gdx.audio.newMusic(Gdx.files.internal("sfx/rcrMusic.ogg"));
		chillMusic.setLooping(true);
		thump = Gdx.audio.newSound(Gdx.files.internal("sfx/click3.ogg"));
		textLeftSpeed = MathUtils.random(11f, 15f);
		textLeftSpeed2 = MathUtils.random(11f, 15f);
		textLeftSpeed3 = MathUtils.random(11f, 15f);
		textLeftSpeed4 = MathUtils.random(11f, 15f);
		textLeftSpeed5 = MathUtils.random(11f, 15f);
		textLeftSpeed6 = MathUtils.random(11f, 15f);
		textLeftSpeed7 = MathUtils.random(11f, 15f);
		textLeftSpeed8 = MathUtils.random(11f, 15f);
	}

	@Override
	public void show() {
		if (!Global.SetVolumeToZero)
			sfx_titlescreen.play();
		Gdx.input.setInputProcessor(new InputAdapter() {
			@Override
			public boolean keyDown(int keyCode) {
				// add this first part for the pause portion of the screen. The escape button.
				// Otherwise retain the space control.
				// Maybe we'll have a clickable button on the bottom side for options?
				if (keyCode == Input.Keys.ESCAPE && !Global.IsPaused) {
					if (!Global.SetVolumeToZero)
						enter.play(2f);
					Global.IsPaused = true;
				} else if (keyCode == Input.Keys.ESCAPE && Global.IsPaused && Global.IsKeyBindings && Global.IsSetKey) {
					if (!Global.SetVolumeToZero)
						enter2.play(2f);
					Global.IsSetKey = false;
				} else if (keyCode == Input.Keys.ESCAPE && Global.IsPaused && Global.IsKeyBindings) {
					if (!Global.SetVolumeToZero)
						enter2.play(2f);
					Global.IsKeyBindings = false;
					pp.IsSwitchingToKeyBindings = true;
				} else if (keyCode == Input.Keys.ESCAPE && Global.IsPaused) {
					if (!Global.SetVolumeToZero)
						enter2.play(2f);
					Global.IsPaused = false;
				} else if ((keyCode == Input.Keys.SPACE || Gdx.input.isTouched()) && !Global.IsPaused) {
					Global.resetPlayersStats();
					// LevelTmx.isPlayerXYGotten = false;
					dispose();
					ScreenUtils.clear(0, 0, 0, 1);
					Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
					System.out.println(
							"oh? you pressed start. Quick, scramble people. Find someone. Make a game fast!! *slap* ow, what was that for? GET THE GAME YOU IDIOT, LOAD IT OR I\"M GOING TO DUNK YOU");
					Global.WhatLevel = 1;
					rcr.GameSettings.putInteger("whatLevel", 1);
					rcr.GameSettings.flush();
					game.setScreen(new LevelMinusThree(game));
				}
				if (Global.IsSetKey && Global.IsPaused)
					Global.KeycodeSet = keyCode;
				return true;
			}

			@Override
			public boolean touchDown(int x, int y, int pointer, int button) {// this is for capturing mouse clicks
				if (Global.IsSetKey)
					Global.KeycodeSet = button;
				return true;
			}

		});
		// start the play back of the background music
		// when the screen is shown
		chillMusic.setVolume(.7f);
		if (!Global.IsMusicPaused)
			chillMusic.play();
	}

	@Override
	public void render(float delta) {
		ScreenUtils.clear(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		game.batch.setProjectionMatrix(camera.combined);
		if (!isCameraPositionInitialized) {
			cameraInitX = camera.position.x;
			cameraInitY = camera.position.y;
			isCameraPositionInitialized = true;
		}
		game.batch.begin();
		// add pause person. This is added to every screen in the game you want a pause
		// menu.
		if (Global.IsPaused) {
			pp.RenderEntirePauseMenu(delta, game, game.font, chillMusic, camera);
//			DebugRenderer.DrawDebugRectangle(pp.saveGameRect, Color.RED, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.loadGameRect, Color.GREEN, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.muteSoundRect, Color.PURPLE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.muteMusicRect, Color.BLUE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.keyBindingsRect, Color.ORANGE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.backRect, Color.BROWN, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.exitGameRect, Color.PINK, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.crouchRect, Color.WHITE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.sprintRect, Color.GRAY, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.keyBindingsBackRect, Color.YELLOW, camera.combined);
		} else {
			mousePos = camera.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
			dropTitleLetters(camera);

			game.batch.end();
			// if timer is less than .65 you need to go up.
			if (timer <= .648f) {
				up = true;
			}
			if (up)// if timer is greater than .68 you need to go down.
				timer += MathUtils.random(.001f, .0005f);
			else
				timer -= MathUtils.random(.001f, .0005f);
			if (timer >= .67f) {
				up = false;
			}
			// if timer is less than .65 you need to go up.
			if (timer2 <= .5f) {
				up2 = true;
			}
			if (up2)// if timer is greater than .68 you need to go down.
				timer2 += MathUtils.random(.0001f, .0005f);
			else
				timer2 -= MathUtils.random(.0001f, .0005f);
			if (timer2 >= .501f) {
				up2 = false;
			}
			if (timer3 >= 100f) {
				upLocation = MathUtils.random(.01f, .07f);
				timer3 = 0f;
			}
			if (timer3 < 100f)
				timer3 += .3f;
			widthX = widthX + 200 * MathUtils.cos(angle) * 1.5f;
			heightY = heightY + 0 * MathUtils.sin(angle);
			angle += .01f;
			if (angle >= 360)
				angle = 1;
			widthX2 = widthX2 + 200 * MathUtils.cos(angle2) * 1.5f;
			heightY2 = heightY2 - 10 * MathUtils.sin(angle2);
			angle2 += .01f;
			if (angle2 >= 360)
				angle2 = 1;
			widthX3 = widthX3 + 200 * MathUtils.cos(angle3) * 1.5f;
			heightY3 = heightY3 - 20 * MathUtils.sin(angle3);
			angle3 += .01f;
			if (angle3 >= 360)
				angle3 = 1;
			widthX4 = widthX4 + 200 * MathUtils.cos(angle4) * 1.5f;
			heightY4 = heightY4 + 10 * MathUtils.sin(angle4);
			angle4 += .01f;
			if (angle4 >= 360)
				angle4 = 1;
			widthX5 = widthX5 + 200 * MathUtils.cos(angle5) * 1.5f;
			heightY5 = heightY5 + 15 * MathUtils.sin(angle5);
			angle5 += .01f;
			if (angle5 >= 360)
				angle5 = 1;
			widthX6 = widthX6 + 101 * MathUtils.cos(angle6) * 1.5f;
			heightY6 = heightY6 + 11 * MathUtils.sin(angle6);
			angle6 += .01f;
			if (angle6 >= 360)
				angle6 = 1;
			widthMouse = mousePos.x + 200f * MathUtils.cos(angle7) * 1.5f;
			heightMouse = mousePos.y + 10f * MathUtils.sin(angle7);
			angle7 += .05f;
			if (angle7 >= 360)
				angle7 = 1;

			if (Gdx.input.isKeyJustPressed(Input.Keys.Q)) {
				// System.out.println("inputing Q");
				System.out.println("\r\r\r\r\r\r\r");// i dont know how to clear the consel this way without clicking on the
														// button.:)
				dispose();// hee hee i figured out how to reset the level. xD (dispose of the level and
							// reload it. ;-) )
				game.setScreen(new TitleScreen(game));
			}
		}
	}

	public void dropTitleLetters(OrthographicCamera camera) {
		float _targetWidth = 1200f;
		int _halign = 1;
		boolean _wrap = false;
		float _o = 50f;
		for (int i = 0; i < 1; i++) {
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.RED);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft + i + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textX + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.WHITE);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft2 + i + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textX2 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.MAROON);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft3 + i + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textX3 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.WHITE);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft4 + i + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textX4 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.RED);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft5 + i + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textX5 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.WHITE);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft6 + i + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textX6 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.MAROON);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft7 + i + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textX7 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.WHITE);
			game.font.draw(game.batch, "RASTIC RUSH", textLeft8 + i + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textX8 + Gdx.graphics.getHeight() * .302f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
		}
		game.font.getData().setScale(1.0f);

		game.font.setColor(Color.GRAY);
		game.font.draw(game.batch, "Press SPACE to Start!", Gdx.graphics.getWidth() * timer2 / 2 * .151f + 100 + timer2, Gdx.graphics.getHeight() / 4.5f * 1.209f,
				_targetWidth, _halign, _wrap);
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.RED);
			game.font.draw(game.batch, "collect all of them?", widthX, heightY - 100, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.RED);
			game.font.draw(game.batch, "collect all of them?", widthX, heightY - 100, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.ORANGE);
			game.font.draw(game.batch, "get that money", widthX2, heightY2 - 100, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.ORANGE);
			game.font.draw(game.batch, "get that money", widthX2, heightY2 - 100, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "eliminate all that stand in your way", widthX3, heightY3 - 100, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "eliminate all that stand in your way", widthX3, heightY3 - 100, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.BLUE);
			game.font.draw(game.batch, "LD58, made in 48 hours!", widthX4, heightY4 - 100, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.BLUE);
			game.font.draw(game.batch, "LD58, made in 48 hours!", widthX4, heightY4 - 100, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.PURPLE);
			game.font.draw(game.batch, "tell your mother you love her", widthX5, heightY5 - 100, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.PURPLE);
			game.font.draw(game.batch, "tell your mother you love her", widthX5, heightY5 - 100, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.VIOLET);
			game.font.draw(game.batch, "ride a unicorn today!", widthX6, heightY6 - 100, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.VIOLET);
			game.font.draw(game.batch, "ride a unicorn today!", widthX6, heightY6 - 100, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.GRAY);
			game.font.draw(game.batch, "perfickle", widthX6 + 400f * timer3 * upLocation, heightY6 + 100f * timer3 * .1f, _targetWidth, _halign, _wrap);
		}
		if (rcr.GameSettings.getBoolean("isFairyEvent")) {
			game.font.getData().setScale(.5f);
			game.font.setColor(Color.CYAN);
			game.font.draw(game.batch, "hello, secret camera", 800f, 100f + timer2, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(1.0f);
		}
		game.font.setColor(Color.SCARLET);
		game.font.draw(game.batch, "I am so FAST!", widthX6 * timer3 * upLocation, heightY6 * timer3 * .1f, _targetWidth, _halign, _wrap);
		game.font.setColor(Color.RED);
		game.font.draw(game.batch, "RASTIC RUSH", widthMouse - 600f, heightMouse - 10f, _targetWidth, _halign, _wrap);
		game.font.setColor(Color.WHITE);
		game.font.draw(game.batch, "RASTIC RUSH", widthMouse - 600f, heightMouse, _targetWidth, _halign, _wrap);
		// System.out.println("y: " + Gdx.graphics.getHeight() * 1.2f);
		game.font.setColor(Color.WHITE);
		widthX = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX2 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY2 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX3 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY3 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX4 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY4 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX5 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY5 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX6 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY6 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthMouse = mousePos.x;// Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightMouse = mousePos.y;// Gdx.graphics.getHeight() / 4 * 1.2f;
		game.font.draw(game.batch, "press SPACE to Start!", Gdx.graphics.getWidth() * timer2 / 2 * .15f + 100, Gdx.graphics.getHeight() / 4.5f * 1.2f, _targetWidth,
				_halign, _wrap);
		game.font.getData().setScale(1.0f);// this resets the rest of the font to normal (it's only used for the above

		for (int i = 0; i < 2; i++) {
			game.font.setColor(.2f, .4f, setColorNumber(i), 1);
			if (isNameZoomRight && isNameZoomUp)
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX - 16 * i), (float) (nameZoomY - 20 * i));
			else if (isNameZoomRight && !isNameZoomUp)
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX - 16 * i), (float) (nameZoomY + 20 * i));
			else if (!isNameZoomRight && isNameZoomUp)
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX + 16 * i), (float) (nameZoomY - 20 * i));
			else
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX + 16 * i), (float) (nameZoomY + 20 * i));
		}
		game.font.getData().setScale(1f);
		game.font.setColor(Color.BLUE);
		game.font.draw(game.batch, "By Commanderstitch!", nameZoomX, nameZoomY + 50);
		game.font.getData().setScale(1.0f);// this resets the rest of the font to normal (it's only used for the above

		// move the name left and right. then up and down. ruld//
		float _offsetX = -500f;
		if (nameZoomX <= 16)
			isNameZoomRight = true;
		if (nameZoomX >= rcr.MW - 246)
			isNameZoomRight = false;
		if (isNameZoomRight)
			nameZoomX += MathUtils.random(2f, 4f);
		else
			nameZoomX -= MathUtils.random(2f, 4f);
//		if (nameZoomY <= 64)
//			nameZoomY = rcr.MH;
//		if (nameZoomY >= rcr.MH + 100)
//			isNameZoomUp = false;
//		nameZoomY = 16;
//		if (isNameZoomUp)
//			nameZoomY += MathUtils.random(2f, 4f);
//		else
//			nameZoomY -= MathUtils.random(2f, 4f);

		if (textLeft >= rcr.MW - 50) {
			textLeft = -rcr.MW;
			textLeftSpeed = MathUtils.random(3f, 15f);
			textX = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft += textLeftSpeed;
		if (textLeft2 >= rcr.MW - 50) {
			textLeft2 = -rcr.MW;
			textLeftSpeed2 = MathUtils.random(3f, 15f);
			textX2 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft2 += textLeftSpeed2;
		if (textLeft3 >= rcr.MW - 50) {
			textLeft3 = -rcr.MW;
			textLeftSpeed3 = MathUtils.random(3f, 15f);
			textX3 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft3 += textLeftSpeed3;
		if (textLeft4 >= rcr.MW - 50) {
			textLeft4 = -rcr.MW;
			textLeftSpeed4 = MathUtils.random(3f, 15f);
			textX4 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft4 += textLeftSpeed4;
		if (textLeft5 >= rcr.MW - 50) {
			textLeft5 = -rcr.MW;
			textLeftSpeed5 = MathUtils.random(3f, 15f);
			textX5 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft5 += textLeftSpeed5;
		if (textLeft6 >= rcr.MW - 50) {
			textLeft6 = -rcr.MW;
			textLeftSpeed6 = MathUtils.random(3f, 15f);
			textX6 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft6 += textLeftSpeed6;
		if (textLeft7 >= rcr.MW - 50) {
			textLeft7 = -rcr.MW;
			textLeftSpeed7 = MathUtils.random(3f, 15f);
			textX7 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft7 += textLeftSpeed7;
		if (textLeft8 >= rcr.MW - 50) {
			textLeft8 = -rcr.MW;
			textLeftSpeed8 = MathUtils.random(3f, 15f);
			textX8 = MathUtils.random(_offsetX, rcr.MW + _offsetX);
		}
		textLeft8 += textLeftSpeed8;

		if (cameraShakeTimer > 0) {
			u.UsefulMethods.MoveCameraAroundRandomly(camera, 1, 1);
			camera.update();
			cameraShakeTimer -= 1;
		} else {
			camera.position.x = cameraInitX;
			camera.position.y = cameraInitY;
		}
	}

	private float setScaleSize(int i) {
		if (i == 0)
			return 4.0f;
		if (i == 1)
			return 3.8f;
		if (i == 2)
			return 3.6f;
		if (i == 3)
			return 3.4f;
		if (i == 4)
			return 3.2f;
		if (i == 5)
			return 3.0f;
		if (i == 6)
			return 2.8f;
		if (i == 7)
			return 2.6f;
		if (i == 8)
			return 2.4f;
		if (i == 9)
			return 2.2f;
		if (i == 10)
			return 2.0f;
		if (i == 11)
			return 1.8f;
		if (i == 12)
			return 1.6f;
		if (i == 13)
			return 1.4f;
		if (i == 14)
			return 1.2f;
		if (i == 15)
			return 1.0f;
		if (i == 16)
			return .8f;
		if (i == 17)
			return .6f;
		if (i == 18)
			return .4f;
		if (i == 19)
			return .2f;
		if (i == 20)
			return .1f;
		else
			return 3.0f;
	}

	private float setScaleSize2(int i) {
		if (i == 0)
			return 3.9f;
		if (i == 1)
			return 3.7f;
		if (i == 2)
			return 3.5f;
		if (i == 3)
			return 3.3f;
		if (i == 4)
			return 3.1f;
		if (i == 5)
			return 2.9f;
		if (i == 6)
			return 2.7f;
		if (i == 7)
			return 2.5f;
		if (i == 8)
			return 2.3f;
		if (i == 9)
			return 2.1f;
		if (i == 10)
			return 1.9f;
		if (i == 11)
			return 1.7f;
		if (i == 12)
			return 1.5f;
		if (i == 13)
			return 1.3f;
		if (i == 14)
			return 1.1f;
		if (i == 15)
			return .9f;
		if (i == 16)
			return .7f;
		if (i == 17)
			return .5f;
		if (i == 18)
			return .3f;
		if (i == 19)
			return .1f;
		if (i == 20)
			return .09f;
		else
			return 3.0f;
	}

	private float setScaleSizeY(int i) {
		if (i == 0)
			return 3.0f;
		if (i == 1)
			return 2.9f;
		if (i == 2)
			return 2.8f;
		if (i == 3)
			return 2.7f;
		if (i == 4)
			return 2.6f;
		if (i == 5)
			return 2.5f;
		if (i == 6)
			return 2.4f;
		if (i == 7)
			return 2.3f;
		if (i == 8)
			return 2.2f;
		if (i == 9)
			return 2.1f;
		if (i == 10)
			return 2.0f;
		if (i == 11)
			return 1.9f;
		if (i == 12)
			return 1.8f;
		if (i == 13)
			return 1.7f;
		if (i == 14)
			return 1.6f;
		if (i == 15)
			return 1.5f;
		if (i == 16)
			return 1.4f;
		if (i == 17)
			return 1.3f;
		if (i == 18)
			return 1.2f;
		if (i == 19)
			return 1.1f;
		if (i == 20)
			return 1.0f;
		else
			return 3.0f;
	}

	private float setColorNumber(int i) {
		if (i == 0)
			return 1f;
		if (i == 1)
			return .9f;
		if (i == 2)
			return .8f;
		if (i == 3)
			return .7f;
		if (i == 4)
			return .6f;
		if (i == 5)
			return .5f;
		if (i == 6)
			return .4f;
		if (i == 7)
			return .3f;
		if (i == 8)
			return .2f;
		if (i == 9)
			return .1f;
		if (i == 10)
			return .1f;
		else
			return 1f;
	}

	@Override
	public void hide() {
		Gdx.input.setInputProcessor(null);
	}

	@Override
	public void resize(int width, int height) {
		vport.update(width, height, true);
	}

	@Override
	public void pause() {
	}

	@Override
	public void resume() {
	}

	@Override
	public void dispose() {
		sfx_titlescreen.dispose();
		enter.dispose();
		enter2.dispose();
		thump.dispose();
		chillMusic.dispose();
	}

}
