require( "scripts/style.lua" );
require( "scripts/ui/style_text.lua" );

SliderFont = {
  standardFont,
  16,
  BlackColor
};

local dlgname="optionsmenu";
local dlg_options_timer = {
    name = "pnl_pause",
    category = "UI",
};

local kOffBtnX = 85;
local kOffBtnY = 95;

MakeDialog
{
    BitmapVisual
    {
        name="bmp_fade_menu",
        image    = "cutscenes/black",
        alpha_val = 0.5,
        --scale_val = 2000.0,
        x = 512, y = 384,
        w = 1024, h = 768,
        
        OptionsWindow
        {
            x=512, y=384,
            --w=kMax,h=kMax,
            fit=true,
            
            name=dlgname,
            timer_settings = dlg_options_timer,

            state_handlers = {
                justcreated = function()
                    ShowControl(dlgname);
                    kOptionsShowed = true;
                end;
                hidden = function()
                    kOptionsShowed = false;
                    CloseWindow();
                end;
            },
            
            Bitmap
            {
                x = kCenter,
                y = kCenter,
                
                image="backgrounds/dialog",
                SetStyle(TextStyle),
                CreateMinionShadowText(18, WhiteColor, 140, 40,  "sfxlevel",     60, 50),
                CreateMinionShadowText(18, WhiteColor, 140, 80,  "musiclevel",   60, 50),
                CreateMinionShadowText(18, WhiteColor, 140, 120, "ambientlevel", 60, 50),
                
                SetStyle(CheckboxButtonStyle),            
                PlayerButton
                {
                    name="fullscreen",
                    label="fullscreen",
                    x=140,
                    y=160,
                    w=150,
                    font = CreateNamedFont(MinionSbItSymbolSet, 18, WhiteColor),
                    command=function()
                        if (ToggleFullScreen() == false) then
                            DisplayDialog { 
                                "scripts/ok.lua", 
                                body ="screenswitchfailed",
                                title = "" 
                            };
                        end
                    end
                    
                },
                
                PlayerButton
                {
                    name="mutebox",
                    x=280,
                    y=160,
                    w=175,
                    label="mutesound",
                    font = CreateNamedFont(MinionSbItSymbolSet, 18, WhiteColor),
                    command =
                        function()
                        ToggleSoundMute();
                    end
                },

                SetStyle(ButtonStyle),
                Button
                {
                    x = kCenter - kOffBtnX,
                    y = kMax - kOffBtnY,
                    name="back",
                    label="back",
                    cancel=true,
                    default=true,
                    type = kPush,
                    font = CreateNamedFont(MinionSbItSymbolSet, 24, ButtonBrown),
                    command = function()
                        SaveVolumes();
                        PlaySound("audio/sfx/main_menu/screenswitch.ogg");
                        HideControl("optionsmenu");
                    end;
                },
                
                Button
                {
                    x = kCenter + kOffBtnX,
                    y = kMax - kOffBtnY,
                    name="credits",
                    label="creditsbutton",
                    type = kPush,
                    font = CreateNamedFont(MinionSbItSymbolSet, 24, ButtonBrown),
                    command = function()
                        PlaySound("audio/sfx/main_menu/screenswitch.ogg");
                        DoModal("scripts/credits.lua");
                    end;
                },

                SetStyle(SliderStyle),
                SliderExt
                {
                    name="sfxlevelslider",
                    x = 200,
                    y = 50,
                    w = 240,
                    sound_test = "audio/sfx/main_menu/button_click.ogg",
                },
                
                Slider
                {
                    name="musiclevelslider",
                    x = 200,
                    y = 90,
                    w = 240,
                },
                
                SliderExt
                {
                    name="ambientlevelslider",
                    x = 200,
                    y = 130,
                    w = 240,
                    sound_test = "audio/sfx/main_menu/button_click.ogg",
                },

                -- LAMP FX

                WndFxSprite
                {
                    name = "left_lamp_firebugs_fx",
                    x = 0,
                    y = 0,
                    w = 580,
                    h = 310,
                    effect_position = "67,96",
                    file_name = "fx/lamp_firebugs.lua",
                    start_activate = true,
                    advance = 50,
                    anim_pool = "pause",
                    timer_settings = dlg_options_timer,
                },

                WndFxSprite
                {
                    name = "right_lamp_firebugs_fx",
                    x = 0,
                    y = 0,
                    w = 580,
                    h = 310,
                    effect_position = "518,96",
                    file_name = "fx/lamp_firebugs.lua",
                    start_activate = true,
                    advance = 50,
                    anim_pool = "pause",
                    timer_settings = dlg_options_timer,
                },

                WndFxSprite
                {
                    name = "left_lamp_light_fx",
                    x = 0,
                    y = 0,
                    w = 580,
                    h = 310,
                    effect_position = "67,96",
                    file_name = "fx/lamp_light.lua",
                    start_activate = true,
                    advance = 50,
                    anim_pool = "pause",
                    timer_settings = dlg_options_timer,
                },

                WndFxSprite
                {
                    name = "right_lamp_light_fx",
                    x = 0,
                    y = 0,
                    w = 580,
                    h = 310,
                    effect_position = "518,96",
                    file_name = "fx/lamp_light.lua",
                    start_activate = true,
                    advance = 50,
                    anim_pool = "pause",
                    timer_settings = dlg_options_timer,
                },
            },
        },
    },
}