require "scripts/style"

kButtonSpacing = 48;	-- Put our buttons 60 pixels apart
kButtonY = kCenter-55;	-- 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 );

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

		SetStyle(LargeEmptyRoundButtonStyle),
		Button
		{
			x=kCenter,
			y=kButtonY-30,
			name="pausemenu_resumebutton",
			label="resume",
			close = true,	-- Just close this window
			cancel=true,
			command=
				function()
                    if(gGameRunning == true) then
                        SendGameMessage( "pause_ended" );
                    end
--                    PopModal("pausemenu");
	                SetState( kPause, false );
				end;

		},

		Button
		{
			x = kCenter,
			y = kButtonY + (kButtonSpacing * 1),
			name = "restart_level",
			label = "restart",
            --close = true,
			command=
				function()
                    if(gGameRunning == true) then
                        DoModal("scripts/restartverify.lua");
                    end
				end;
		},
        
		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 2),
			name="optionsbutton",
			label="optionsbutton",
			command=
				function()
					-- Pop up an options screen
					DoModal("scripts/options.lua");
				end
		},

		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 3),
			name="quit",
			label="mainmenu",
            close = true,
            type = kPush,            
			command=
				function()
                    --PopModal("pausemenu");
                    SendGameMessage( "quit" );
                    SetState( kPause, false );
                    
					--DoModal('scripts/mainmenu.lua');
					-- Our game processes this message--it's not
					-- handled by Playground
                    -- SendGameMessage( "quit" );
				end
		},
	},
}