Unify input behind Engine::Input facade; fix Ctrl+P and Pause button

New Engine/Core/Input.h/.cpp: static input facade with a Key/MouseButton
enum (values map to GLFW key codes internally) so scripts and game logic
no longer touch GLFW directly - window backend becomes swappable and the
facade is the surface to expose when embedding scripting later. Wired up
in Application's constructor; Camera (editor camera WASD/RMB/MMB), the
WASDMove script and SandboxApp key handling now query Input only.

Ctrl+P hotkey fix: the !m_Playing guard made the hotkey dead exactly
when it was needed - after pressing Play. Now toggles both ways.

Toolbar Pause button now reads "Resume" while paused (tooltip follows).
This commit is contained in:
2026-10-05 11:34:27 +08:00
parent c083ee5cb7
commit 641b255cb2
7 changed files with 161 additions and 29 deletions
+5
View File
@@ -4,6 +4,7 @@
#include <Engine/Core/Application.h>
#include <Engine/Core/Window.h>
#include <Engine/Core/Input.h>
#include <Engine/Core/Log.h>
#include <Engine/ECS/Scene.h>
#include <Engine/Physics/PhysicsWorld.h>
@@ -39,6 +40,10 @@ namespace Engine {
// 资产层不感知 Vulkan 具体类。
// 声明在 Renderer 之后 → 析构先于 Renderer(它引用其子模块)
m_Assets = CreateScope<Assets::AssetManager>(m_Renderer->GetAssetUploader());
// 统一输入门面装配:脚本/游戏逻辑经 Input 查询键鼠,不直接
// 依赖 Window 后端(GLFW 解耦)
Input::Init(*m_Window);
}
Application::~Application()