- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
1.2 KiB
1.2 KiB
ResourceManager::LoadAsync
void LoadAsync(const Containers::String& path, ResourceType type,
std::function<void(LoadResult)> callback)
void LoadAsync(const Containers::String& path, ResourceType type,
ImportSettings* settings, std::function<void(LoadResult)> callback)
异步加载资源。将加载请求提交到 AsyncLoader,在后台工作线程执行加载,完成后在主线程通过回调通知。
参数:
path- 资源路径type- 资源类型settings- 导入设置(可为 nullptr)callback- 加载完成回调
返回: 无
复杂度: 提交 O(1),实际加载 O(n)
示例:
ResourceManager::Get().LoadAsync("textures/terrain.png", ResourceType::Texture,
[](LoadResult result) {
if (result.success) {
ResourceHandle<Texture> tex(result.resource);
printf("Loaded: %s\n", tex->GetPath().CStr());
}
});
ResourceManager::Get().LoadAsync("models/player.fbx", ResourceType::Mesh,
nullptr,
[](LoadResult result) {
if (result.success) {
ResourceHandle<Mesh> mesh(result.resource);
}
});
相关文档
- ResourceManager 总览 - 返回类总览