--============================================================================
--  main_menu.lua
--  Copyright (c) 2010; Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------
require('scripts/style.lua');

gInit = true;

function closeMainMenu()
    if (gGameStyle == "quest") then
        SwapToModal("scripts/metamap.lua");
    elseif (gGameStyle == "quick") then
        SwapToModal("scripts/quick_play.lua");
    else
        SwapToModal("scripts/loading.lua");
    end
end

-- Clear style.
gGameStyle = "";

MakeDialog {
    name = 'screenMainMenu';

    wndMainMenu {
        x = 0; y = 0; w = kMax; h = kMax;

        avatar_boy  = { x = 20; y = 290};
        avatar_girl = { x = 20; y = 290};
        avatar_cat  = { x = 30; y = 278};
        avatar_dog  = { x = 30; y = 290};

        Bitmap {
            x = kCenter;
            y = 20;
            image = 'gpx/screens/logo_titlecard';
        };

        SetStyle(ButtonStyle);
        Button {
            name = 'btnQuestMode';
            label = 'Quest Mode';
            x = 524; y = 381;
            font = Font30;
            graphics = PlayButtonGraphics;
            command =
                function()
                    gGameStyle = "quest";
                    gfn_animClose();
                end
        };
        Button {
            name = 'btnQuickPlay';
            label = 'Quick Play';
            x = 558; y = 457;
            font = Font23;
            graphics = QuickPlayButtonGpx;
            command =
                function()
                    gGameStyle = "quick";
                    gfn_animClose();
                end
        };

        SetStyle(ChangePlayerButtonStyle);
        Button {
            name = 'btnAchievements';
            label = 'btnAchievements';
            font = Font14;
            x = 352; y = 718;
            command =
                function()
                    DoModal('scripts/achievement.lua');
                end
        };
        Button {
            name = 'btnInstructions';
            label = 'btnInstructions';
            font = Font14;
            x = 519; y = 718;
            command =
                function()
                    DoModal('scripts/instructions.lua');
                end
        };
        Button {
            name = 'btnOptions';
            label = 'btnOptions';
            font = Font14;
            x = 687; y = 718;
            command =
                function()
                    DoModal('scripts/options.lua');
                end
        };
        Button {
            name = 'btnMainMenuQuit';
            label = 'btnMainMenuQuit';
            font = Font14;
            x = 856; y = 718;
            command =
                function()
                    DoModal('scripts/quit_verify.lua');
                end
        };

        Bitmap {
            image = 'gpx/screens/player_name_titlecard';
            x = 100; y = 622;

            Text {
                name = "lblWelcome";
                font = Font16;
                x = 8; y = 32; w = 240; h = 20;
                flags = kHAlignCenter + kVAlignCenter;
                label = "lblWelcome";
            };

            Bitmap {
                name = "bmpName";
                image = "gpx/screens/player_name_scroll_titlecard";
                x = 22; y = 48;

                Text {
                    name = "lblUserName";
                    font = Font20;
                    x = 10; y = 5; 
                    w = 180; h = 25;
                    flags = kHAlignCenter + kVAlignCenter;
                };
            };
        };

        SetStyle(PauseButtonStyle);
        Button {
            name = 'btnChangePlayer';
            label = 'btnChangePlayer';
            font = Font13;
            scale = 0.65;
            x = 162; y = 710;
            command =
                function()
                    DoModal("scripts/change_player.lua");
                end
        };

    };
}

SetFocus('wndMainMenu');
