Input facade: add cursor capture, mouse delta and scroll delta
SetCursorCaptured / IsCursorCaptured / GetMouseDelta / ConsumeScrollDelta now route through the Input facade, so the editor camera no longer takes a Window& at all: Camera::Update and EditorCamera::Update lose their window parameter and SandboxApp calls Update(dt) directly. App layer now has zero Window/GLFW usage for input - everything goes through Engine::Input.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Engine {
|
||||
}
|
||||
}
|
||||
|
||||
void Camera::Update(Window& window, ECS::TransformComponent& transform,
|
||||
void Camera::Update(ECS::TransformComponent& transform,
|
||||
const f32 deltaTime, const bool flyRequiresRMB)
|
||||
{
|
||||
// ---- 输入模式(UE Scene view 语义):RMB=自由视角(鼠标转向
|
||||
@@ -41,13 +41,13 @@ namespace Engine {
|
||||
|
||||
if (wantLook || wantOrbit)
|
||||
{
|
||||
if (!window.IsCursorCaptured())
|
||||
if (!Input::IsCursorCaptured())
|
||||
{
|
||||
window.SetCursorCaptured(true);
|
||||
Input::SetCursorCaptured(true);
|
||||
}
|
||||
|
||||
f32 mouseDX = 0, mouseDY = 0;
|
||||
window.GetMouseDelta(mouseDX, mouseDY);
|
||||
Input::GetMouseDelta(mouseDX, mouseDY);
|
||||
|
||||
if (mouseDX != 0 || mouseDY != 0)
|
||||
{
|
||||
@@ -105,9 +105,9 @@ namespace Engine {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (window.IsCursorCaptured())
|
||||
else if (Input::IsCursorCaptured())
|
||||
{
|
||||
window.SetCursorCaptured(false);
|
||||
Input::SetCursorCaptured(false);
|
||||
}
|
||||
|
||||
// 基向量由(可能已更新的)实体旋转决定(本地 -Z 为视线方向)
|
||||
@@ -130,7 +130,7 @@ namespace Engine {
|
||||
|
||||
// ---- 滚轮推拉:有 pivot 时改环绕距离(指数步进,近处精细/
|
||||
// 远处大步);无 pivot 时沿视线平移 ----
|
||||
const f32 wheel = window.ConsumeScrollDelta();
|
||||
const f32 wheel = Input::ConsumeScrollDelta();
|
||||
if (m_MouseLookEnabled && wheel != 0.0f)
|
||||
{
|
||||
if (m_HasPivot)
|
||||
|
||||
Reference in New Issue
Block a user