docs: update resources API docs
This commit is contained in:
49
docs/api/resources/resource-file-system/initialize.md
Normal file
49
docs/api/resources/resource-file-system/initialize.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# ResourceFileSystem::Initialize
|
||||
|
||||
## 方法签名
|
||||
|
||||
```cpp
|
||||
void Initialize(const Containers::String& rootPath);
|
||||
```
|
||||
|
||||
## 所属类
|
||||
|
||||
`XCEngine::Resources::ResourceFileSystem`
|
||||
|
||||
## 描述
|
||||
|
||||
初始化资源文件系统,设置资源根目录路径。调用此方法后,资源系统将以指定路径作为基础路径进行资源搜索。
|
||||
|
||||
此方法线程安全。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数名 | 类型 | 描述 |
|
||||
|--------|------|------|
|
||||
| `rootPath` | `const Containers::String&` | 资源根目录的绝对路径 |
|
||||
|
||||
## 返回值
|
||||
|
||||
无
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
#include "Resources/ResourceFileSystem.h"
|
||||
|
||||
using namespace XCEngine::Resources;
|
||||
|
||||
ResourceFileSystem& fs = ResourceFileSystem::Get();
|
||||
|
||||
// 初始化资源文件系统
|
||||
fs.Initialize("C:/Game/Resources");
|
||||
|
||||
// 现在可以添加其他资源来源并访问资源
|
||||
fs.AddDirectory("C:/Game/Assets");
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 应在程序启动早期调用此方法
|
||||
- 如果已存在资源,系统会先清空现有配置
|
||||
- `Shutdown()` 会重置根路径设置
|
||||
Reference in New Issue
Block a user