Files
XCEngine/docs/api/XCEngine/Input/InputManager/GetMouseDelta.md

31 lines
666 B
Markdown
Raw Normal View History

2026-03-26 16:45:24 +08:00
# InputManager::GetMouseDelta
2026-03-26 17:39:53 +08:00
读取当前帧保存的鼠标位移。
2026-03-26 16:45:24 +08:00
```cpp
Math::Vector2 GetMouseDelta() const;
```
2026-03-26 17:39:53 +08:00
## 行为说明
2026-03-26 16:45:24 +08:00
2026-03-26 17:39:53 +08:00
当前实现返回最近一次 [ProcessMouseMove](ProcessMouseMove.md) 写入的 `m_mouseDelta`。它有两个重要特点:
2026-03-26 16:45:24 +08:00
2026-03-26 17:39:53 +08:00
- 不是累加值,而是最近一次输入事件的 delta
- 会在 [Update](Update.md) 时被重置为 `Vector2::Zero()`
2026-03-26 16:45:24 +08:00
2026-03-26 17:39:53 +08:00
## 返回值
2026-03-26 16:45:24 +08:00
2026-03-26 17:39:53 +08:00
- `Math::Vector2` - 当前保存的鼠标位移。
## 示例
2026-03-26 16:45:24 +08:00
2026-03-26 17:39:53 +08:00
```cpp
auto delta = XCEngine::Input::InputManager::Get().GetMouseDelta();
2026-03-26 16:45:24 +08:00
```
## 相关文档
2026-03-26 17:39:53 +08:00
- [返回类型总览](InputManager.md)
- [ProcessMouseMove](ProcessMouseMove.md)
- [Update](Update.md)