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:
@@ -17,6 +17,8 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "Engine/Core/Types.h"
|
||||
|
||||
namespace Engine {
|
||||
|
||||
class Window;
|
||||
@@ -78,12 +80,29 @@ namespace Engine {
|
||||
Middle = 2,
|
||||
};
|
||||
|
||||
// 装配:Application 构造时自动调用(后端 Window 就绪后)
|
||||
void Init(const Window& window);
|
||||
// 装配:Application 构造时自动调用(后端 Window 就绪后)。
|
||||
// 非 const:门面含状态设置(光标捕获),不只是查询
|
||||
void Init(Window& window);
|
||||
|
||||
// 轮询查询(UI 捕获对应输入时返回 false——游戏侧静默)
|
||||
bool IsKeyDown(Key key);
|
||||
bool IsMouseButtonDown(MouseButton button);
|
||||
|
||||
// ---- 光标捕获(自由视角三件套:隐藏光标 + 无界鼠标增量 +
|
||||
// 滚轮增量)。语义沿 Window 后端:捕获时光标隐藏、位置锁定
|
||||
// 窗口中心,GetMouseDelta 出无界增量;重复设置同值无操作 ----
|
||||
|
||||
// 隐藏并锁定光标(自由视角/环绕中);false 恢复正常光标
|
||||
void SetCursorCaptured(bool captured);
|
||||
bool IsCursorCaptured();
|
||||
|
||||
// 帧间光标增量(无界,捕获态下才有意义;窗口尺寸/模式变化
|
||||
// 由后端参考点重置防跳变)
|
||||
void GetMouseDelta(f32& dx, f32& dy);
|
||||
|
||||
// 滚轮增量(上行 = +1,一档 ≈1):读后清零。UI 捕获鼠标
|
||||
//(面板悬停)时不累积——滚轮归 ImGui
|
||||
f32 ConsumeScrollDelta();
|
||||
}
|
||||
|
||||
} // namespace Engine
|
||||
|
||||
Reference in New Issue
Block a user