|
@@ -10,6 +10,7 @@
|
|
|
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
+// 2018-02-20: Inputs: Renamed GLFW callbacks exposed in .h to not include Vulkan in their name.
|
|
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback, ImGui_ImplGlfwVulkan_Render() calls ImGui_ImplGlfwVulkan_RenderDrawData() itself.
|
|
|
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
|
|
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
|
@@ -340,20 +341,20 @@ static void ImGui_ImplGlfwVulkan_SetClipboardText(void* user_data, const char* t
|
|
|
glfwSetClipboardString((GLFWwindow*)user_data, text);
|
|
|
}
|
|
|
|
|
|
-void ImGui_ImplGlfwVulkan_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
|
|
|
+void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
|
|
|
{
|
|
|
if (action == GLFW_PRESS && button >= 0 && button < 3)
|
|
|
g_MouseJustPressed[button] = true;
|
|
|
}
|
|
|
|
|
|
-void ImGui_ImplGlfwVulkan_ScrollCallback(GLFWwindow*, double xoffset, double yoffset)
|
|
|
+void ImGui_ImplGlfw_ScrollCallback(GLFWwindow*, double xoffset, double yoffset)
|
|
|
{
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
io.MouseWheelH += (float)xoffset;
|
|
|
io.MouseWheel += (float)yoffset;
|
|
|
}
|
|
|
|
|
|
-void ImGui_ImplGlfwVulkan_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
|
|
|
+void ImGui_ImplGlfw_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
|
|
|
{
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
if (action == GLFW_PRESS)
|
|
@@ -368,7 +369,7 @@ void ImGui_ImplGlfwVulkan_KeyCallback(GLFWwindow*, int key, int, int action, int
|
|
|
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
|
|
|
}
|
|
|
|
|
|
-void ImGui_ImplGlfwVulkan_CharCallback(GLFWwindow*, unsigned int c)
|
|
|
+void ImGui_ImplGlfw_CharCallback(GLFWwindow*, unsigned int c)
|
|
|
{
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
if (c > 0 && c < 0x10000)
|
|
@@ -746,6 +747,14 @@ void ImGui_ImplGlfwVulkan_InvalidateDeviceObjects()
|
|
|
if (g_Pipeline) { vkDestroyPipeline(g_Device, g_Pipeline, g_Allocator); g_Pipeline = VK_NULL_HANDLE; }
|
|
|
}
|
|
|
|
|
|
+static void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
|
|
|
+{
|
|
|
+ glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
|
|
|
+ glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
|
|
|
+ glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
|
|
|
+ glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
|
|
|
+}
|
|
|
+
|
|
|
bool ImGui_ImplGlfwVulkan_Init(GLFWwindow* window, bool install_callbacks, ImGui_ImplGlfwVulkan_Init_Data *init_data)
|
|
|
{
|
|
|
g_Allocator = init_data->allocator;
|
|
@@ -789,12 +798,7 @@ bool ImGui_ImplGlfwVulkan_Init(GLFWwindow* window, bool install_callbacks, Im
|
|
|
#endif
|
|
|
|
|
|
if (install_callbacks)
|
|
|
- {
|
|
|
- glfwSetMouseButtonCallback(window, ImGui_ImplGlfwVulkan_MouseButtonCallback);
|
|
|
- glfwSetScrollCallback(window, ImGui_ImplGlfwVulkan_ScrollCallback);
|
|
|
- glfwSetKeyCallback(window, ImGui_ImplGlfwVulkan_KeyCallback);
|
|
|
- glfwSetCharCallback(window, ImGui_ImplGlfwVulkan_CharCallback);
|
|
|
- }
|
|
|
+ ImGui_ImplGlfw_InstallCallbacks(window);
|
|
|
|
|
|
ImGui_ImplGlfwVulkan_CreateDeviceObjects();
|
|
|
|