package com.ld57.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;

public class ddd extends Game {
	public SpriteBatch batch;
	public BitmapFont font;
	public BitmapFont screenFont;

	public static final int MW = 1920;// happens to be the same as viewport width
	public static final int MH = 1010;// happens to be the same as viewport height//full screen failed. This is the next best option.
	public static final int VW = 1920;
	public static final int VH = 1010;// full screen failed. This is the next best option.
	public static final int LW = 720;// tile code:
	public static final int LH = 480;
	public static final int TW = 15;
	public static final int TH = 15;
	public static final int TTW = 15;
	public static final int TTH = 15;
	public static Preferences GameSettings;
	public static float Speed = 200;
	public static int NumberOfKittens = 1;
	public static int TruckArriveTimer = 1000;
	// possible loading screen stuff. this doesn't work and never has. I don't know why and I don't know how others do it. :P (i've tried)
	private OrthographicCamera camera;
	private FitViewport vport;
	private UIDe uIde;

	public void create() {
		camera = new OrthographicCamera();
		vport = new FitViewport(ddd.MW, ddd.MH, camera);
		batch = new SpriteBatch();
		font = new BitmapFont(Gdx.files.internal("ddd.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("this title screen looks juicy. mmmmm!");
		// this.setScreen(new Store(this));
		this.setScreen(new TitleScreen(this));
		// this.setScreen(new LoseScreen(this, "You died before you got in the game"));
		// 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;
	}
}
