30 lines
485 B
Markdown
30 lines
485 B
Markdown
|
|
# Texture::GetWidth
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
Core::uint32 GetWidth() const
|
||
|
|
```
|
||
|
|
|
||
|
|
获取纹理宽度。
|
||
|
|
|
||
|
|
**参数:** 无
|
||
|
|
|
||
|
|
**返回:** 纹理宽度(像素)
|
||
|
|
|
||
|
|
**线程安全:** ✅
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
Texture tex;
|
||
|
|
tex.Create(1024, 512, 1, 1,
|
||
|
|
TextureType::Texture2D,
|
||
|
|
TextureFormat::RGBA8_UNORM,
|
||
|
|
nullptr, 0);
|
||
|
|
|
||
|
|
Core::uint32 width = tex.GetWidth(); // 返回 1024
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [Texture 总览](texture.md) - 返回类总览
|
||
|
|
- [GetHeight](getheight.md) - 获取纹理高度
|