docs: update math API docs
This commit is contained in:
34
docs/api/math/viewport/getrect.md
Normal file
34
docs/api/math/viewport/getrect.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Viewport::GetRect
|
||||
|
||||
```cpp
|
||||
Rect GetRect() const;
|
||||
```
|
||||
|
||||
将视口转换为 Rect。
|
||||
|
||||
**返回:** 对应的 Rect(x, y, width, height),不包含深度范围
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/Math/Rect.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
int main() {
|
||||
Viewport viewport(0.0f, 0.0f, 1920.0f, 1080.0f, 0.0f, 1.0f);
|
||||
Rect rect = viewport.GetRect();
|
||||
std::cout << "Rect: (" << rect.x << ", " << rect.y << ", " << rect.width << ", " << rect.height << ")\n";
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [`Viewport::GetAspectRatio`](getaspectratio.md) - 获取宽高比
|
||||
- [Viewport 总览](viewport.md)
|
||||
Reference in New Issue
Block a user