require( "scripts/style.lua" );



InfoFont = {
  standardFont,
  30,
  BorderColor
};

function InstantQuit( )
	DebugOut("InstantQuit!");
	ActivatePauseClock(false);
	QuitGame(true);
	PopModal(); -- pop off quit menu
	PopModal(); -- take off pause menu
	-- the main game will get popped off by the quit dialog returning 
end

MakeDialog
{

	ScreenFade
	{
		x=0,
		y=0,
		w=kMax,
		h=kMax,
		name="screenfade"
	},
	
	Bitmap
	{
		name="pausebackground",
		image="backgrounds/popup",
		x=kCenter,
		y=kCenter,
		
		Text
		{
			font = InfoFont,
			name = "gamepaused",
			x=31,y=120,w=404,h=32,
			flags = kHAlignCenter + kVAlignTop,
			label = "gamepaused"
		};
			
		
		Button
		{
			x=50,
			y=175,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="resume",
			label="resume",
			type = kPush,
			command=
				function()
					ActivatePauseClock(false);
				    PauseMusic(false);
					PauseGame(false);
					PopModal();
				end
		},
		
		Button
		{
			x=50,
			y=225,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="restart",
			label="restart",
			type = kPush,
			command=
				function()
					ActivatePauseClock(false);
					RestartLevel();
					PauseGame(false);
					PopModal();
				end
		},
		
		Button
		{
			x=240,
			y=175,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="help",
			label="help",
			type = kPush,
			command=
				function()
					DoModal("scripts/help1.lua");
				end
		},
		
		Button
		{
			x=240,
			y=225,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="options",
			label="options",
			type = kPush,
			command=
				function()
					DoModal("scripts/options.lua");
				end
		},
		
		Button
		{
			x=kCenter,
			y=275,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="quit",
			label="quit",
			type = kPush,
			command=
				function()
					result = DisplayDialog { 
							"scripts/yesno.lua", 
							body ="quitconfirm",
							title = "",
							yes = InstantQuit
					};

	--				if (result=='yes') then
	--					ActivatePauseClock(false);
	--					QuitGame(true);
	--					PopModal(); -- take off pause menu
	--					SwapToModalSetName("scripts/mainmenu.lua");
	--				end
				end
		},
	},
};
ActivatePauseClock(true);
PauseMusic(true);
SetFade(kDisableFade);