Silence missing placeholder tile textures
This commit is contained in:
@@ -33,7 +33,7 @@ UI
|
|||||||
- 支持 source rect。
|
- 支持 source rect。
|
||||||
- 支持 `.map` tile entry 绘制。
|
- 支持 `.map` tile entry 绘制。
|
||||||
- 支持 tileset 图片缺失时按 tile fallback 色绘制。
|
- 支持 tileset 图片缺失时按 tile fallback 色绘制。
|
||||||
- 资源缺失时回退色块,不阻断场景运行。
|
- 资源缺失时先检查 `Asset::exists()`,再回退色块,不触发纹理加载错误日志。
|
||||||
|
|
||||||
## 约束
|
## 约束
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <frostbite2D/graphics/renderer.h>
|
#include <frostbite2D/graphics/renderer.h>
|
||||||
#include <frostbite2D/graphics/types.h>
|
#include <frostbite2D/graphics/types.h>
|
||||||
#include <frostbite2D/graphics/texture.h>
|
#include <frostbite2D/graphics/texture.h>
|
||||||
|
#include <frostbite2D/resource/asset.h>
|
||||||
|
|
||||||
namespace ns_game {
|
namespace ns_game {
|
||||||
|
|
||||||
@@ -174,6 +175,11 @@ StageRenderer::getTexture(const std::string& texturePath) const {
|
|||||||
return existing->second;
|
return existing->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!frostbite2D::Asset::get().exists(texturePath)) {
|
||||||
|
textureCache_[texturePath] = nullptr;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
frostbite2D::Ptr<frostbite2D::Texture> texture =
|
frostbite2D::Ptr<frostbite2D::Texture> texture =
|
||||||
frostbite2D::Texture::loadFromFile(texturePath);
|
frostbite2D::Texture::loadFromFile(texturePath);
|
||||||
if (texture) {
|
if (texture) {
|
||||||
|
|||||||
Reference in New Issue
Block a user