package u;

import com.ld52.agent.Agent;

public class Uinput {
	// set defaults
	private static int left = 29;
	private static int right = 32;
	private static int up = 51;
	private static int down = 47;
	private static int fire = 0;
	private static int jump = 62;
	private static int inventory = 37;
	private static int crouch = 59;
	private static int sprint = 129;
	private static int cancel = 1;

	public Uinput() {

	}

	public static void LoadDefaultInputs() {
		boolean first = Agent.GameSettings.getBoolean("IsFirstTimeRunningGame");// this is going to be backwards because it defaults to false.
		// System.out.println("first: " + first);
		if (!first) {// if the first time the game is running, set all the defaults
			Agent.GameSettings.putBoolean("IsFirstTimeRunningGame", true);// remember this has to be backwards to work.^^
			Agent.GameSettings.putInteger("left_key", 29);// a = 29
			Agent.GameSettings.putInteger("right_key", 32);// d = 32
			Agent.GameSettings.putInteger("up_key", 51);// w = 51
			Agent.GameSettings.putInteger("down_key", 47);// s = 47
			Agent.GameSettings.putInteger("fire_key", 0);// left_mouse_button = 0
			Agent.GameSettings.putInteger("cancel_key", 1);// right_mouse_button = 0
			Agent.GameSettings.putInteger("jump_key", 62);// space = 62
			Agent.GameSettings.putInteger("inventory_key", 37);// i = 37
			Agent.GameSettings.putInteger("crouch_key", 59);// = left_shift = 59
			Agent.GameSettings.putInteger("sprint_key", 129);// = left_control = 129
			Agent.GameSettings.flush();
		} else {// if not, load the defaults?... uhhhh
			left = Agent.GameSettings.getInteger("left_key");
			right = Agent.GameSettings.getInteger("right_key");// d = 32
			up = Agent.GameSettings.getInteger("up_key");// w = 51
			down = Agent.GameSettings.getInteger("down_key");// s = 47
			fire = Agent.GameSettings.getInteger("fire_key");// left_mouse_button = 0
			cancel = Agent.GameSettings.getInteger("cancel_key");// right_mouse_button = 1
			jump = Agent.GameSettings.getInteger("jump_key");// space = 62
			inventory = Agent.GameSettings.getInteger("inventory_key");// i = 37
			crouch = Agent.GameSettings.getInteger("crouch_key");// = left_shift = 59
			sprint = Agent.GameSettings.getInteger("sprint_key");// = left_control = 129
		}

	}

	public static int Left() {
		return left;
	}

	public static int Right() {
		return right;
	}

	public static int Up() {
		return up;
	}

	public static int Down() {
		return down;
	}

	public static int Fire() {
		return fire;
	}

	public static int Cancel() {
		return cancel;
	}

	public static int Jump() {
		return jump;
	}

	public static int Inventory() {
		return inventory;
	}

	public static int Crouch() {
		return crouch;
	}

	public static int Sprint() {
		return sprint;
	}

}
