require( "scripts/style.lua" );

SliderFont = {
	standardFont,
	24,
	BlackColor
};
sfxPosY = 140;
musicPosY = 230;

MakeDialog
{
	FadeWindow
	{
		x = 0, y = 0,
		w = ScreenWight, h = ScreenHeight,
		--w = 694, h = 548,
		name="optionsmenu",
		Bitmap
		{
			image="menu/dialog",
			x = kCenter,
			y = kCenter,

			OptionsWindow
			{
				name="options_menu",
				x=0,y=0,w=kMax,h=kMax,
				
			Text
			{
				font = HeaderFont,
				name = "title",
				x=kCenter,y=65,w=kMax,h=75,
				flags = kHAlignCenter + kVAlignTop,
				label = "options"
			};

				Text
				{
					font = SliderFont,
					name = "sfx",
					x=kCenter - 160,
					y=sfxPosY,
					w=150,
					h=50,
					flags = kHAlignCenter + kVAlignCenter,
					label = "sfxlevel"
				};

				Text
				{
					font = SliderFont,
					name = "music",
					x=kCenter - 160,
					y=musicPosY,
					w=150,
					h=50,
					flags = kHAlignCenter + kVAlignCenter,
					label = "musiclevel"
				};

				-- fullscreen
				Text
				{
					font = SliderFont,
					name = "fullscreentext",
					x=kCenter - 160,
					y=kMax-230,
					w=150,
					h=50,
					flags = kHAlignCenter + kVAlignCenter,
					label = "fullscreen"
				};

				SetStyle(CheckboxButtonStyle),
				Button
				{
					name="fullscreen",
					x=kCenter-60,
					y=kMax-240,
					w=50,
					h=50,
					command=
					function()
						if (ToggleFullScreen() == false) then
						PlaySfx(mainMenuOpenSound);
							DisplayDialog {
								"scripts/ok1.lua",
								body = "screenswitchfailed",
								title = ""
							};
						end
					end
				};

				--SetStyle( MenuButtonOk ),
				SetStyle(ProfilesButtonStyle);
				Button
				{
					x=kCenter,
					y=kMax-110,
					name="back",
					label="back",
					cancel=true,
					default=true,
					type = kPush,
					command =
					function()
						SaveOptions(); 
						CloseFade("optionsmenu","CloseWindow()");
					end;
				},
				
				SetStyle(ProfilesButtonStyle);
				Button
				{
					name="credits",
					label="credits",
					x=kCenter+210,
					y=kMax-230,
					command=
						function()
							PlaySfx(mainMenuOpenSound);
							DoModal("scripts/credits.lua");
						end
				},

				SetStyle(SliderStyle),
				-- звуки
				QESlider
				{
					name="sfxlevelslider",
					bg = "assets/menu/slider_bg",
					roll = "assets/menu/slider_roll",
					rollover = "assets/menu/slider_roll_over",
					x = kCenter + 80,
					y = sfxPosY,
					w = 262,
					h = 24,
					rollw = 32,
					soundover = mainMenuOverSound,
					soundpress = mainMenuButtonSound,
				};

				-- музыка
				QESlider
				{
					name = "musiclevelslider",
					bg = "assets/menu/slider_bg",
					roll = "assets/menu/slider_roll",
					rollover = "assets/menu/slider_roll_over",
					x = kCenter + 80,
					y = musicPosY,
					w = 262,
					h = 24,
					rollw = 32,
					soundover = mainMenuOverSound,
					soundpress = mainMenuButtonSound,
				},
			},
		},
	},
}