docs: update resources API docs
This commit is contained in:
46
docs/api/resources/resource-file-system/resource-info.md
Normal file
46
docs/api/resources/resource-file-system/resource-info.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# ResourceInfo 结构
|
||||
|
||||
## 头文件
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/Resources/ResourceFileSystem.h"
|
||||
```
|
||||
|
||||
## 命名空间
|
||||
|
||||
`XCEngine::Resources`
|
||||
|
||||
## 描述
|
||||
|
||||
`ResourceInfo` 结构体用于存储资源的元数据信息,包括资源路径、大小、修改时间和所属档案等。
|
||||
|
||||
## 成员变量
|
||||
|
||||
| 变量 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `path` | `Containers::String` | 资源的相对路径 |
|
||||
| `size` | `size_t` | 资源大小(字节) |
|
||||
| `modifiedTime` | `Core::uint64` | 最后修改时间戳 |
|
||||
| `inArchive` | `bool` | 是否位于档案压缩包内 |
|
||||
| `archivePath` | `Containers::String` | 所属档案的路径(如果位于档案内) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include "Resources/ResourceFileSystem.h"
|
||||
|
||||
using namespace XCEngine::Resources;
|
||||
|
||||
ResourceFileSystem& fs = ResourceFileSystem::Get();
|
||||
ResourceInfo info;
|
||||
|
||||
if (fs.GetResourceInfo("textures/player/diffuse.png", info)) {
|
||||
printf("Path: %s\n", info.path.CStr());
|
||||
printf("Size: %zu bytes\n", info.size);
|
||||
printf("Modified: %llu\n", info.modifiedTime);
|
||||
printf("In Archive: %s\n", info.inArchive ? "Yes" : "No");
|
||||
if (info.inArchive) {
|
||||
printf("Archive: %s\n", info.archivePath.CStr());
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user