-- events for ui screen



function OnLoad ()

end;


function OnEnter ()

end;

function OnLeave ()
end;


function OnClick (name)

	Print ("OnClick " .. name .. "\n");
	
	if (name == "Resume") then
		PopScreen ("GamePopMenu");
		return;
	end;
	
	if (name == "Options") then
		PushScreen ("Options");
		return;
	end;

	if (name == "Instructions") then
		PushScreen ("Instructions");
		return;
	end;
	
	if (name == "MainMenu") then
		if (IsScreenInStack ("Game")) then
			SaveGameState ("Game");
		else -- assume hidden object game
			SaveGameState ("HiddenObject");
		end;
		SwitchScreen ("MainMenu");
		return;
	end;
end;


function OnUpdate (tdelta)

	akey = GetActiveScreenAnimKey ();

	trans = math.sin (0.5*3.1415926535 * GetActiveScreenTransPhase ());
	--Print ("trans " .. trans .. "\n");
	SetProperty ("arc:position_offset.y", (1-trans) * 250);
	SetProperty ("arc:alpha", trans);
	SetProperty ("fader:alpha", trans + trans * 0.05 * math.sin (2*3.141592*akey));
end;

function OnDraw ()

end;
