Как я могу создать окно ImGui, которое может перемещать и перетаскивать родительское окно glfw? ⇐ C++
Как я могу создать окно ImGui, которое может перемещать и перетаскивать родительское окно glfw?
I have used the glfwgetwindowpos and glfwsetwindowpos with imgui's getmousedragdelta to try and move the parent glfw window using imgui. What I am trying to accomplish is to have an imgui window where I am able to drag on it, but rather than moving the imgui window, it moves the parent glfw window causing everything inside that window to move along with it. I have been able to accomplish what I am trying to do, but occasionally, the glfw window just teleports to a random location on my screen.
Here is a simplified version of the code that still causes the issue:
ImGui::Begin("Test Window"); ImGui::End(); if (ImGui::IsMouseDragging(ImGuiMouseButton_Left)) { int windowXPos = 0; int windowYPos = 0; glfwGetWindowPos(window, &windowXPos, &windowYPos); glfwSetWindowPos(window, windowXPos + ImGui::GetMouseDragDelta(ImGuiMouseButton_Left).x, windowYPos + ImGui::GetMouseDragDelta(ImGuiMouseButton_Left).y); }
Источник: https://stackoverflow.com/questions/780 ... ent-glfw-w
I have used the glfwgetwindowpos and glfwsetwindowpos with imgui's getmousedragdelta to try and move the parent glfw window using imgui. What I am trying to accomplish is to have an imgui window where I am able to drag on it, but rather than moving the imgui window, it moves the parent glfw window causing everything inside that window to move along with it. I have been able to accomplish what I am trying to do, but occasionally, the glfw window just teleports to a random location on my screen.
Here is a simplified version of the code that still causes the issue:
ImGui::Begin("Test Window"); ImGui::End(); if (ImGui::IsMouseDragging(ImGuiMouseButton_Left)) { int windowXPos = 0; int windowYPos = 0; glfwGetWindowPos(window, &windowXPos, &windowYPos); glfwSetWindowPos(window, windowXPos + ImGui::GetMouseDragDelta(ImGuiMouseButton_Left).x, windowYPos + ImGui::GetMouseDragDelta(ImGuiMouseButton_Left).y); }
Источник: https://stackoverflow.com/questions/780 ... ent-glfw-w
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение