var yPos : float;
var xPos : float;

var buttonWidth : int = 256;
var buttonHeight : int = 48;
var buttonPadding : int = 16;

var nativeVerticalResolution = 864.0;
var nativeHorizontalResolution = 1152.0;

var gSkin : GUISkin;
var currentScreen : String = "Menu";

function OnGUI() {
	GUI.skin = gSkin;
	
	xPos = nativeHorizontalResolution / 2 - buttonWidth / 2;
	yPos = nativeVerticalResolution / 2 - 200;
	
	GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (Screen.height / nativeVerticalResolution, Screen.height / nativeVerticalResolution, 1));
	if(currentScreen == "Menu"){
		if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "Play")){
			Application.LoadLevel(PlayerPrefs.GetString("Level", "Level1"));
		}
		yPos += (buttonHeight + buttonPadding);
		if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "Vote")){
			Application.OpenURL("http://www.udevgames.com/");
		}
		yPos += (buttonHeight + buttonPadding);
		if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "Options")){
			currentScreen = "Options";
		}
		yPos += (buttonHeight + buttonPadding);
		if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "Credits")){
			currentScreen = "Credits";
		}
		yPos += (buttonHeight + buttonPadding);
				if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), Screen.fullScreen ? "Windowed" : "Full Screen")){
			Screen.fullScreen = !Screen.fullScreen;
		}
	} else if(currentScreen == "Options"){
		if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "Back")){
			currentScreen = "Menu";
		}
	} else if(currentScreen == "Credits"){
		GUI.Label(Rect(xPos, yPos, buttonWidth, buttonHeight), "Programming, Sound: Lincoln Green", "Credits");
		yPos += (buttonHeight + buttonPadding);
		GUI.Label(Rect(xPos, yPos, buttonWidth, buttonHeight), "Art: Micah Green \n Lincoln Green", "Credits");
		yPos += (buttonHeight + buttonPadding);
		GUI.Label(Rect(xPos, yPos, buttonWidth, buttonHeight), "Music, Story: Nathan Green", "Credits");
		yPos += (buttonHeight + buttonPadding);
		GUI.Label(Rect(xPos, yPos, buttonWidth, buttonHeight), "Design: Lincoln Green, Micah Green", "Credits");
		yPos += (buttonHeight + buttonPadding);
		if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "Back")){
			currentScreen = "Menu";
		}
	}
}

@script ExecuteInEditMode()