Files
XCEngine/docs/api/resources/audio-loader/can-load.md
ssdfasd 1797e7fe17 fix: encapsulate OpenGL types in VertexAttribute to eliminate raw GL API usage in tests
- Add VertexAttributeType and VertexAttributeNormalized enums in OpenGLVertexArray.h
- Add ToGLAttributeType() converter in OpenGLVertexArray.cpp
- Remove glActiveTexture() call from quad test (already handled by texture.Bind())
- Remove #include <glad/glad.h> from triangle test
- Update unit tests to use encapsulated enums

All three OpenGL integration tests (minimal, triangle, quad) pass with 0% pixel difference.
2026-03-22 14:33:57 +08:00

37 lines
974 B
Markdown

# AudioLoader::CanLoad
## 方法签名
```cpp
bool CanLoad(const Containers::String& path) const override;
```
## 详细描述
根据文件扩展名判断此加载器是否能处理指定路径的资源。检测时先提取路径扩展名(小写),再与支持列表逐一比对。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `path` | `const Containers::String&` | 资源文件的完整或相对路径 |
## 返回值
`bool` - 如果扩展名在支持列表中返回 `true`,否则返回 `false`
## 示例
```cpp
AudioLoader loader;
// 正确识别支持的格式
bool canLoad1 = loader.CanLoad("assets/audio/bgm.ogg"); // true
bool canLoad2 = loader.CanLoad("sound_effect.wav"); // true
bool canLoad3 = loader.CanLoad("music.mp3"); // true
// 识别不支持的格式
bool canLoad4 = loader.CanLoad("video.avi"); // false
bool canLoad5 = loader.CanLoad("document.pdf"); // false
```