require( "scripts/style" );

SliderFont = {
  buttonFont,
  21,
  Color(150,150,150,255)
};


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

		OptionsWindow
		{
			x=0,y=0,w=kMax,h=kMax,

			Text
			{
				font = DialogTitleShadowFont,
				x=kCenter-1, y=2,
				w=kMax,h=40,
				flags = kVAlignCenter + kHAlignCenter,
				label= "options",
			};
			Text
			{
				font = DialogTitleFont,
				x=kCenter, y=1,
				w=kMax,h=40,
				flags = kVAlignCenter + kHAlignCenter,
				label = "options",
			};

			Text
			{
				font = SliderFont,
				name = "sfx",
				x=30,y=40,w=100,h=50,
				flags = kHAlignCenter + kVAlignCenter,
				label = "sfxlevel"
			};

			Text
			{
				font = SliderFont,
				name = "music",
				x=30,y=80,w=100,h=50,
				flags = kHAlignCenter + kVAlignCenter,
				label = "musiclevel"
			};

			SetStyle(CheckboxButtonStyle),
			Button{
				name="mutebox",
				x=80,
				y=135,
				w=175,
				label = "mutesound",
				command =
					function()
						ToggleSoundMute();
					end
			};
			
			Button{
				name="fullscreen",
				label="fullscreen",
				x=80,
				y=165,
				w=150,
				command=
				function()
					if (ToggleFullScreen() == false) then
						DisplayDialog {
							"scripts/ok.lua",
							body ="screenswitchfailed",
							title = "playground"
						};
					end
				end

			};

			Button{
				name="letterbox",
				x=80,
				y=195,
				w=200,
				label = "letterbox",
				command =
					function()
					if (ToggleLetterbox() == false) then
						DisplayDialog {
							"scripts/ok.lua",
							body ="screenswitchfailed",
							title = "playground"
						};
					end
						
					end
			};

			SetStyle(ButtonStyle),
			Button
			{
				x = kCenter+114,
				y = kMax-66,
				name="back",
				cancel=true,
				default=true,
				type = kPush,
				graphics={
					"buttons/button_nextup",
					"buttons/button_nextdown",
					"buttons/button_nextover",
				},
				command =
					function()
						SaveVolumes();
						PopModal("optionsmenu");
					end
			},

			Button
			{
				x = kCenter-76,
				y = kMax-64,
				name="credits",
				label="creditsbutton",
				type = kPush,
				command =
					function()
						DoModal("scripts/credits.lua");
					end
			},

			SetStyle(SliderStyle),
			Slider
			{
				name="sfxlevelslider",
				x = 140,
				y = 50,
				w = 160,
			};

			Slider
			{
				name="musiclevelslider",
				x = 140,
				y = 90,
				w = 160,
			};
		},
	},
}