docs: fix resources module documentation discrepancies
- Add missing MakeResourceGUID helper function to resourcetypes.md - Add note about GetResourceType<T>() template specializations - Merge duplicate '缓存控制' section into '内存管理' in resourcecache.md - Verify all methods documented match source code implementations Fixed documentation to match: - ResourceTypes.h: MakeResourceGUID function now documented - ResourceCache.h: OnZeroRefCount and Clear methods now properly listed - AsyncLoader.md: Removed duplicate progress query section
This commit is contained in:
@@ -58,11 +58,6 @@
|
||||
| `size_t GetMemoryBudget() const` | 获取内存预算 |
|
||||
| `void OnMemoryPressure(size_t requiredBytes)` | 内存压力回调,驱逐资源以释放空间 |
|
||||
| `void OnZeroRefCount(ResourceGUID guid)` | 当引用计数为零时的回调 |
|
||||
|
||||
### 缓存控制
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `void Flush()` | 清空缓存,释放所有资源 |
|
||||
| `void Clear()` | 清空缓存但不释放资源 |
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ struct ResourceGUID {
|
||||
| 函数 | 描述 |
|
||||
|------|------|
|
||||
| `constexpr const char* GetResourceTypeName(ResourceType type)` | 获取资源类型的字符串名称 |
|
||||
| `ResourceGUID MakeResourceGUID(const char* path)` | 从路径生成 GUID 的辅助函数 |
|
||||
|
||||
### 模板特化
|
||||
|
||||
@@ -92,6 +93,8 @@ template<> inline ResourceType GetResourceType<class AudioClip>() { return Resou
|
||||
template<> inline ResourceType GetResourceType<class BinaryResource>() { return ResourceType::Binary; }
|
||||
```
|
||||
|
||||
**注意**: `GetResourceType<T>()` 是模板特化函数,用于在编译时获取资源类型。
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
|
||||
Reference in New Issue
Block a user