feat: 输入隔离——ImGui WantCapture 在 Window 层门控事件与轮询
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#include <Engine/Vulkan/Device.h>
|
||||
#include <Engine/ImGui/ImGuiLayer.h>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Engine {
|
||||
@@ -57,6 +59,12 @@ namespace Engine {
|
||||
|
||||
m_ImGuiLayer = CreateScope<ImGuiLayer>(GetWindow(), *m_Renderer);
|
||||
m_Renderer->SetImGuiLayer(m_ImGuiLayer.get());
|
||||
|
||||
// 输入隔离:ImGui 想要的输入不再透给游戏侧
|
||||
//(事件回调与轮询接口在 Window 层统一门控)
|
||||
GetWindow().SetInputCapture(
|
||||
[] { return ImGui::GetIO().WantCaptureKeyboard; },
|
||||
[] { return ImGui::GetIO().WantCaptureMouse; });
|
||||
}
|
||||
|
||||
void Application::Run()
|
||||
|
||||
Reference in New Issue
Block a user