This commit is contained in:
2026-02-08 16:20:50 +08:00
parent 0ae47e5d6a
commit 8b88904ef7
72 changed files with 5963 additions and 2038 deletions

View File

@@ -1,35 +1,47 @@
#include "GameMapLayer.h"
#include "EngineCore/Game.h"
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: 渲染可行区域
// }
// 自身坐标
glm::vec2 Pos = this->ConvertToWorld({0, 0});
// 可行区域
for (auto &info : this->FeasibleAreaInfoList)
{
SDL_Rect buf;
buf.x = info.x + Pos.x;
buf.y = info.y + Pos.y;
buf.w = info.w;
buf.h = info.h;
glm::vec4 red = {1.0f, 0.0f, 0.0f, 0.4f}; // RGBA红色不透明基础色
Game::GetInstance().GetRenderer()->DrawRect(&buf, red);
}
// 移动区域
for (auto &info : this->MoveAreaInfoList)
{
SDL_Rect buf;
buf.x = info.x + Pos.x;
buf.y = info.y + Pos.y;
buf.w = info.w;
buf.h = info.h;
glm::vec4 red = {0.0f, 0.0f, 1.0f, 0.4f}; // RGBA红色不透明基础色
Game::GetInstance().GetRenderer()->DrawRect(&buf, red);
}
}
void GameMapLayer::AddDebugFeasibleAreaInfo(Vec2 pos, VecSize size)
void GameMapLayer::AddDebugFeasibleAreaInfo(Vec2 pos, VecSize size, int Type)
{
SDL_Rect info;
info.x = pos.x;
info.y = pos.y;
info.w = size.width;
info.h = size.height;
this->FeasibleAreaInfoList.push_back(info);
if (Type == 0)
this->FeasibleAreaInfoList.push_back(info);
else if (Type == 1)
this->MoveAreaInfoList.push_back(info);
}
void GameMapLayer::AddObject(RefPtr<Actor> obj)