#include "GameMapLayer.h"
#include "EngineCore/Game.h"

GameMapLayer::GameMapLayer()
{
}

GameMapLayer::~GameMapLayer()
{
}

void GameMapLayer::Render()
{
    Actor::Render();
    RenderManager *renderer = Game::GetInstance().GetRenderer();

    // 自身坐标
    float Xpos = GetIterationPos().x + GetPos().x;
    float Ypos = GetIterationPos().y + GetPos().y;
    for (auto &info : this->FeasibleAreaInfoList)
    {
        SDL_Rect buf;
        buf.x = info.x + Xpos;
        buf.y = info.y + Ypos;
        buf.w = info.w;
        buf.h = info.h;
        //TODO: 渲染可行区域
    }
}

void GameMapLayer::AddDebugFeasibleAreaInfo(Vec2 pos, VecSize size)
{
    SDL_Rect info;
    info.x = pos.x;
    info.y = pos.y;
    info.w = size.width;
    info.h = size.height;
    this->FeasibleAreaInfoList.push_back(info);
}

void GameMapLayer::AddObject(RefPtr<Actor> obj)
{
    this->AddChild(obj);
}
