Browse Source

Examples: DirectX9/11: hide os curosr if ImGui is drawing it (#155)

ocornut 10 years ago
parent
commit
ad7f600e0d

+ 3 - 0
examples/directx11_example/imgui_impl_dx11.cpp

@@ -446,6 +446,9 @@ void ImGui_ImplDX11_NewFrame()
     // io.MouseDown : filled by WM_*BUTTON* events
     // io.MouseDown : filled by WM_*BUTTON* events
     // io.MouseWheel : filled by WM_MOUSEWHEEL events
     // io.MouseWheel : filled by WM_MOUSEWHEEL events
 
 
+    // Hide OS mouse cursor if ImGui is drawing it
+    SetCursor(io.MouseDrawCursor ? NULL : LoadCursor(NULL, IDC_ARROW));
+
     // Start the frame
     // Start the frame
     ImGui::NewFrame();
     ImGui::NewFrame();
 }
 }

+ 3 - 0
examples/directx9_example/imgui_impl_dx9.cpp

@@ -281,6 +281,9 @@ void ImGui_ImplDX9_NewFrame()
     // io.MouseDown : filled by WM_*BUTTON* events
     // io.MouseDown : filled by WM_*BUTTON* events
     // io.MouseWheel : filled by WM_MOUSEWHEEL events
     // io.MouseWheel : filled by WM_MOUSEWHEEL events
 
 
+    // Hide OS mouse cursor if ImGui is drawing it
+    SetCursor(io.MouseDrawCursor ? NULL : LoadCursor(NULL, IDC_ARROW));
+
     // Start the frame
     // Start the frame
     ImGui::NewFrame();
     ImGui::NewFrame();
 }
 }

+ 1 - 1
examples/opengl3_example/imgui_impl_glfw_gl3.cpp

@@ -354,7 +354,7 @@ void ImGui_ImplGlfwGL3_NewFrame()
     io.MouseWheel = g_MouseWheel;
     io.MouseWheel = g_MouseWheel;
     g_MouseWheel = 0.0f;
     g_MouseWheel = 0.0f;
 
 
-    // Hide/show hardware mouse cursor
+    // Hide OS mouse cursor if ImGui is drawing it
     glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
     glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
 
 
     // Start the frame
     // Start the frame

+ 1 - 1
examples/opengl_example/imgui_impl_glfw.cpp

@@ -259,7 +259,7 @@ void ImGui_ImplGlfw_NewFrame()
     io.MouseWheel = g_MouseWheel;
     io.MouseWheel = g_MouseWheel;
     g_MouseWheel = 0.0f;
     g_MouseWheel = 0.0f;
 
 
-    // Hide/show hardware mouse cursor
+    // Hide OS mouse cursor if ImGui is drawing it
     glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
     glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
 
 
     // Start the frame
     // Start the frame