package com.ld52.agent;

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.math.MathUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;

import Global.Global;
import u.Uinput;

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

	public static final int MW = 1600;// happens to be the same as viewport width
	public static final int MH = 900;// happens to be the same as viewport height
	public static final int VW = 1600;
	public static final int VH = 900;
	public static final int LW = 900;// tile code:
	public static final int LH = 900;
	public static final int TW = 900;
	public static final int TH = 900;
	public static final int TTW = 900;
	public static final int TTH = 900;
	public static int Score = 0;
	public static Preferences GameSettings;
	public static float Speed = 200;
	public static int Health = 2000;// was 200
	public static int HarvesterHealth = 2000;
	public static int NumberOfKittens = 2000;
	public static int EnemyTruckMovingTimer = MathUtils.random(5500, 6500);
	public static int SavingTruckTimer = 100;
	public static int SavingTruckTimerMax = MathUtils.random(100, 1000);
	public static boolean IsTenSecondsActive = false;
	public static int EvilPlaneTimer = 4000;
	public static int EvilPlaneTimerMax = MathUtils.random(100, 1000);
	public static int HarvestedStuff = 0;
	// possible loading screen stuff. blawhhsddahsuwaa
	private OrthographicCamera camera;
	private FitViewport vport;

	public void create() {
		camera = new OrthographicCamera();
		vport = new FitViewport(Agent.MW, Agent.MH, camera);
		batch = new SpriteBatch();
		font = new BitmapFont(Gdx.files.internal("Agent.fnt"));
		font.setColor(Color.WHITE);
		// loading
		GameSettings = Gdx.app.getPreferences("HD Preferences");
		Global.SetVolumeToZero = GameSettings.getBoolean("isSoundMuted");
		Global.IsMusicPaused = GameSettings.getBoolean("isMusicPaused");
		Uinput.LoadDefaultInputs();
		// set variables and go
		Score = 0;
		System.out.println("we are ready to go to the title screen!!");
		this.setScreen(new TitleScreen(this));
		// this.setScreen(new WinScreen(this));
	}

	@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();
	}
}
