Как я могу создать окно ImGui, которое может перемещать и перетаскивать родительское окно glfw?C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 Как я могу создать окно ImGui, которое может перемещать и перетаскивать родительское окно glfw?

Сообщение Anonymous »


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
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C++»