fix: improve doc link navigation and tree display
- 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
This commit is contained in:
44
docs/api/resources/resourcemanager/loadasync.md
Normal file
44
docs/api/resources/resourcemanager/loadasync.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# ResourceManager::LoadAsync
|
||||
|
||||
```cpp
|
||||
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)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
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 总览](resourcemanager.md) - 返回类总览
|
||||
Reference in New Issue
Block a user