//
//  LoadingScreen.cpp
//  Game
//
//  Created by Darvydas on 27/01/2019.
//

#include "LoadingScreen.hpp"
#include "Game/GameScene/Scene.hpp"

using namespace cocos2d;

cocos2d::Scene* CLoadingScreen::createScene()
{
    return CLoadingScreen::create();
}

bool CLoadingScreen::init()
{
    if (!Scene::init())
    {
        return false;
    }
    
    createVisualElements();
    
    return true;
}

void CLoadingScreen::createVisualElements()
{
    cocos2d::Sprite* pcSprite = Sprite::create("logo on black.png");
    pcSprite->setPosition(Point(this->getContentSize().width * 0.5, this->getContentSize().height * 0.5f));
    
    this->addChild(pcSprite, 200);
    
    this->runAction(Sequence::create(DelayTime::create(1.0f),
                                     CallFunc::create([](){
        auto gs = Game::CScene::createScene(1, 1);
        Director::getInstance()->replaceScene(TransitionFade::create(2.0f, gs, Color3B::BLACK));
    }), NULL));
    
    
}





