require( "scripts/style.lua" );

kButtonSpacing = 60;	-- Put our buttons 60 pixels apart
kButtonY = kCenter-60;	-- Three buttons means center 60 pixels above the center

-- When this dialog is popped up, we're entering pause state, so
-- let's just notify TGameState now.
SetState( kPause, true );
SetState( "dimBg", "1");

DialogHeaderFont = {
  standardFont,
  26,
  WhiteColor
};

MakeDialog
{
	-- Name the modal dialog
	name="pausemenu",
	Bitmap
	{
		image="backgrounds/win_small",
		x=kCenter,
		y=kCenter,

		SetStyle(CloseButtonStyle);
		Button
		{
			x=kCenter+153,y=15-2,
			name="closebutton",
			command = function() 
				SetState( "dimBg", "0");
				CloseWindow(); 
			end;
		};


		Text
		{
			name = "pauseheader",
			label = "pauseheader",
			x=0,y=8,w=kMax,h=kMax,
			flags = kHAlignCenter + kVAlignTop,
			font = DialogHeaderFont,
		},

		SetStyle(ButtonStyle),
		Button
		{
			x=kCenter,
			y=kButtonY,
			name="resumebutton",
			label="resume",
			close = true,	-- Just close this window
			cancel=true,
			hotkey="",
			command=
				function()
	                SetState( kPause, false );
			SetState( "dimBg", "0");
				end;

		},

		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 1),
			name="optionsbutton",
			label="optionsbutton",
			hotkey="",
			command=
				function()
					-- Pop up an options screen
					DoModal("scripts/ingame_options.lua");
				end
		},

		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 2),
			label="quit",
			close=true,
			hotkey="",
			command=
				function()
					--PopModal('pausemenu');
					--DoModal('scripts/gameover.lua');
					-- Our game processes this message--it's not
					-- handled by Playground
                    SendSceneMessage( "quit" );
	                SetState( kPause, false );
			SetState( "dimBg", "0");
				end
		},
	},
}