package com.ld58.game;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.viewport.FitViewport;

import Global.Global;
import u.UIDe;
import u.Uinput;
import u.Uinput1;
import u.Uinput2;
import u.Uinput3;
import u.Uinput4;
import u.Uinput5;
import u.Uinput6;

/** {@link com.badlogic.gdx.ApplicationListener} implementation shared by all platforms. */
public class rcr extends Game {
	public SpriteBatch batch;
	public BitmapFont font;
	public BitmapFont screenFont;

	public static final int MW = 1920;// hey this just happens to be the viewport thingyhaha
	public static final int MH = 1010;
	public static final int VW = 1920;
	public static final int VH = 1010;
	public static final int LW = 720;// tile code?
	public static final int LH = 480;// tile code?
	public static final int TW = 15;// tile code?
	public static final int TH = 15;// tile code?
	public static final int TTH = 15;// tile code?
	public static final int TTW = 15;// tile code?
	public static Preferences GameSettings;
	public static float Speed = 200;
	public static int NumberOfPeople = 1;
	public static int ArriveTimer = 1000;
	public static int Timer = 0;// for how long it takes to get the item.

	private OrthographicCamera camera;
	private FitViewport vport;
	private UIDe uIde;

	@Override
	public void create() {
		camera = new OrthographicCamera();
		vport = new FitViewport(rcr.MW, rcr.MH, camera);
		batch = new SpriteBatch();
		font = new BitmapFont(Gdx.files.internal("rcr.fnt"));
		font.setColor(Color.WHITE);
		// loading
		GameSettings = Gdx.app.getPreferences("HD Preferences");
		Global.SetVolumeToZero = GameSettings.getBoolean("isSoundMuted");
		Global.IsMusicPaused = GameSettings.getBoolean("isMusicPaused");
		Global.WhatLevel = GameSettings.getInteger("level");
		LoadAllTheDefaultInputs();
		setuIde(new UIDe());
		// set variables and go
		// hijack this program.
		// System.out.println("go to the calculator!");
		System.out.println("First, controllers have been implemented, Second, there was nothing. ... but ... wait for it.");
		// this.setScreen(new Store(this));
		this.setScreen(new TitleScreen(this));
		// this.setScreen(new LoseScreen(this, "You died before you got in the game"));
		// Global.WhatLevel = 5;
		// rcr.GameSettings.putInteger("whatLevel", 5);
		// rcr.GameSettings.flush();
		// this.setScreen(new LevelMinusOne(this));
		// this.setScreen(new GameScreen(this));
		// this.setScreen(new WinScreen(this));
	}

	private void LoadAllTheDefaultInputs() {
		Uinput.LoadDefaultInputs();// pause player
		Uinput1.LoadDefaultInputs();// player one
		Uinput2.LoadDefaultInputs();// player two
		Uinput3.LoadDefaultInputs();// player three
		Uinput4.LoadDefaultInputs();// player four
		Uinput5.LoadDefaultInputs();// player five
		Uinput6.LoadDefaultInputs();// player Six
	}

	@Override
	public void render() {
		super.render();
	}

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

	@Override
	public void dispose() {
		batch.dispose();
		font.dispose();
	}

	public UIDe getuIde() {
		return uIde;
	}

	public void setuIde(UIDe uIde) {
		this.uIde = uIde;
	}
}
