mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Split into CaptureKeyboardFromApp() / CaptureMouseFromApp()
This commit is contained in:
parent
77fad80e9f
commit
e0da1e0658
12
imgui.cpp
12
imgui.cpp
@ -3007,10 +3007,14 @@ void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
|
||||
GImGui->MouseCursor = cursor_type;
|
||||
}
|
||||
|
||||
void ImGui::CaptureInputsFromApp(bool capture_mouse, bool capture_keyboard)
|
||||
void ImGui::CaptureKeyboardFromApp()
|
||||
{
|
||||
GImGui->CaptureMouseNextFrame |= capture_mouse;
|
||||
GImGui->CaptureKeyboardNextFrame |= capture_keyboard;
|
||||
GImGui->CaptureKeyboardNextFrame = true;
|
||||
}
|
||||
|
||||
void ImGui::CaptureMouseFromApp()
|
||||
{
|
||||
GImGui->CaptureMouseNextFrame = true;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemHovered()
|
||||
@ -11869,7 +11873,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
|
||||
ImGui::Button("Hover me\nto enforce\ninputs capture");
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::CaptureInputsFromApp();
|
||||
ImGui::CaptureKeyboardFromApp();
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
3
imgui.h
3
imgui.h
@ -385,7 +385,8 @@ namespace ImGui
|
||||
IMGUI_API void ResetMouseDragDelta(int button = 0); //
|
||||
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
||||
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type
|
||||
IMGUI_API void CaptureInputsFromApp(bool mouse = true, bool keyboard = true); // manually enforce imgui setting the io.WantCaptureMouse / io.WantCaptureKeyboard flags next frame (your application needs to handle them). e.g. capture keyboard when your widget is being hovered.
|
||||
IMGUI_API void CaptureKeyboardFromApp(); // manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered.
|
||||
IMGUI_API void CaptureMouseFromApp(); // manually enforce imgui setting the io.WantCaptureMouse flag next frame (your application needs to handle it).
|
||||
|
||||
// Helpers functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO()
|
||||
IMGUI_API void* MemAlloc(size_t sz);
|
||||
|
Loading…
Reference in New Issue
Block a user