Update API documentation and remove obsolete plan files
This commit is contained in:
@@ -1,34 +1,18 @@
|
||||
# Viewport::GetAspectRatio
|
||||
|
||||
```cpp
|
||||
float GetAspectRatio() const;
|
||||
float GetAspectRatio() const
|
||||
```
|
||||
|
||||
获取视口宽高比。
|
||||
|
||||
**返回:** 宽高比 (width / height),如果 height 为 0 则返回 0.0f
|
||||
|
||||
**线程安全:** ✅
|
||||
**返回:** `float` - 宽高比 (width / height),height 为 0 时返回 0.0f
|
||||
|
||||
**复杂度:** 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);
|
||||
float aspect = viewport.GetAspectRatio();
|
||||
std::cout << "Aspect Ratio: " << aspect << "\n";
|
||||
return 0;
|
||||
}
|
||||
Viewport viewport(0, 0, 1920, 1080);
|
||||
float aspect = viewport.GetAspectRatio(); // 1.777... (16:9)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [`Viewport::GetRect`](getrect.md) - 转换为 Rect
|
||||
- [Viewport 总览](viewport.md)
|
||||
Reference in New Issue
Block a user