#include "../application.h"
#include "../scenes.h"
#include "../resources.h"
#include "../utils.h"
#include "../player.h"

static int scene_intro_splash_counter = 0;

void Scene_Intro_Init(void)
{
    Application_SetBGColor(bg_black_color);

    scene_intro_splash_counter = 1;

    Scene_Splash_Run(false, 2, bg_black_color);
}

void Scene_Intro_Update(float dt)
{
    switch(scene_intro_splash_counter)
    {
        case 1: if (Scene_Splash_IsFinish())
                {
                    //загрузка всех ресурвов здесь
                    Resources_Load();
                    Player_Init(); // костыль надо тут

                    Scene_Splash_Run(true, 2, bg_black_color);
                    scene_intro_splash_counter = 2;
                }
                break;

        case 2: if (Scene_Splash_IsFinish())
                    Scene_Set(SCENE_MENU);
                break;
    }
}

void Scene_Intro_Draw(SDL_Renderer *renderer)
{
    int x = (Application_GetWidth() / 2) - 320;
    int y = (Application_GetHeight() / 2) - 320;

    SDL_Rect frame_rect = Utils_GetRect(0, 0, 640, 640);
    SDL_Rect draw_rect  = Utils_GetRect(x, y, 640, 640);

    SDL_RenderCopy(renderer, igdc_logoTex, &frame_rect, &draw_rect);
}

void Scene_Intro_Free(void)
{
}
