---------------------------------------------------------------------------------------------------
--  Copyright © 2009 PoBros, Incorporated. All Rights Reserved.
--
--  This source code is the proprietary confidential property of PoBros Incorporated.
--  Modification, reproduction, publication, or distribution in any form to any party 
--  other than the licensee is strictly prohibited.
--
--  FOR USE BY AUTHORIZED PERSONS ONLY
---------------------------------------------------------------------------------------------------

require( "scripts/style.lua" );

local kSliderWidth = 350;
local kSliderTextYOffset = -15;
local kSliderY = kCenter - 95;
local kSliderYDist = 80;

---------------------------------------------------------------------------------------------------

MakeDialog
{
	name = "options";
	SetStyle( GameWindowStyle );
	
	OptionsWindow
	{
		SetStyle( DialogWindowStyle );
		fullscreen = "fullscreen";
		window = "window";
		music = gs_musicMainMenu;
		
		DialogWindow
		{
			SetStyle( DefaultStyle );
			
			Text
			{
				font = SliderHeaderFont;
				name = "sfx";
				label = "sfxlevel";
				x = kCenter;
				y = kSliderY + kSliderTextYOffset;
				w = kMax;
				h = 50;
				flags = kHAlignCenter + kVAlignCenter;
			};
		
			Text
			{
				font = SliderHeaderFont;
				name = "music";
				label = "musiclevel";
				x = kCenter;
				y = kSliderY + kSliderYDist + kSliderTextYOffset;
				w = kMax;
				h = 50;
				flags = kHAlignCenter + kVAlignCenter;
			};

			Text
			{
				font = TutorialFont;
				name = "Use Custom Cursor";
				label = "usecustomcursor";
				x = kCenter - 110;
				y = kSliderY + kSliderYDist + kSliderTextYOffset + 90;
				w = 165;
				h = 50;
				flags = kHAlignCenter + kVAlignCenter;
			};

			Text
			{
				font = TutorialFont;
				name = "Full Character Dialog";
				label = "fullcharacterdialog";
				x = kCenter + 135;
				y = kSliderY + kSliderYDist + kSliderTextYOffset + 90;
				w = 180;
				h = 50;
				flags = kHAlignCenter + kVAlignCenter;
			};

			SetStyle( CheckboxButtonStyle );
			
			Button
			{
				name = "usecustomcursorbutton";
				x = kCenter - 210;
				y = kSliderY + kSliderYDist + kSliderTextYOffset + 90;
				on = not IsUsingCursorOS();
				
				command =
					function()
						if( IsUsingCursorOS() ) then
							SetCursorOSuse( false );
						else
							SetCursorOSuse( true );
						end
					end
			};

			Button
			{
				name = "fullcharacterdialogbutton";
				x = kCenter + 20;
				y = kSliderY + kSliderYDist + kSliderTextYOffset + 90;
				on = GetFullCharacterDialogState();
				
				command =
					function()
						if( GetFullCharacterDialogState() ) then
							SetFullCharacterDialogState( false );
						else
							SetFullCharacterDialogState( true );
						end
					end
			};

			SetStyle( DialogTitleText );
			
			Text
			{
				name = "title";
				label = "options";
			};
			
			SetStyle( ThreeButtonDialogButton1Style );
			
			Button
			{
				name = "credits";
				text = "credits";

				command =
					function()
						DoModal( "scripts/credits.lua" );
					end
			};

			SetStyle( ThreeButtonDialogButton2Style );
					
			Button
			{
				name = "fullscreentoggle";
				text = "fullscreen";

				command =
					function()
						if( not ToggleFullScreen() ) then
							DisplayDialog
							{
								"scripts/ok.lua";
								body = "fullscreenfailbody";
								title = "fullscreenfailtitle";
							};
						else
							if( IsFullScreen() ) then
								SetFullScreenToggleText( "window" );
							else
								SetFullScreenToggleText( "fullscreen" );
							end
						end
					end
				
			};
			
			SetStyle( ThreeButtonDialogButton3Style );

			Button
			{
				name = "done";
				text = "done";

				command =
					function()
						SaveVolumes();
						WindowReturn();
					end
			};

			SetStyle( SliderStyle );
			
			Slider
			{
				name = "sfxlevelslider";
				x = kCenter;
				y = kSliderY;
				w = kSliderWidth;
				showvalue = true;
			};
			
			Slider
			{
				name = "musiclevelslider";
				x = kCenter;
				y = kSliderY + kSliderYDist;
				w = kSliderWidth;
				showvalue = true;
			}; 
		};
	};
};

---------------------------------------------------------------------------------------------------

if( GetGameMode() == 1 ) then
	SetButtonToggleState( "gamemode1", true );
else
	SetButtonToggleState( "gamemode2", true );
end