Silence missing placeholder tile textures

This commit is contained in:
2026-06-09 23:41:47 +08:00
parent 51a3776494
commit e1429f3046
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ UI
- 支持 source rect。
- 支持 `.map` tile entry 绘制。
- 支持 tileset 图片缺失时按 tile fallback 色绘制。
- 资源缺失时回退色块,不阻断场景运行
- 资源缺失时先检查 `Asset::exists()`,再回退色块,不触发纹理加载错误日志
## 约束
+6
View File
@@ -6,6 +6,7 @@
#include <frostbite2D/graphics/renderer.h>
#include <frostbite2D/graphics/types.h>
#include <frostbite2D/graphics/texture.h>
#include <frostbite2D/resource/asset.h>
namespace ns_game {
@@ -174,6 +175,11 @@ StageRenderer::getTexture(const std::string& texturePath) const {
return existing->second;
}
if (!frostbite2D::Asset::get().exists(texturePath)) {
textureCache_[texturePath] = nullptr;
return nullptr;
}
frostbite2D::Ptr<frostbite2D::Texture> texture =
frostbite2D::Texture::loadFromFile(texturePath);
if (texture) {