Skip to content

Commit

Permalink
Examples: DirectX9/11: hide os curosr if ImGui is drawing it (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed May 1, 2015
1 parent 68ccdc4 commit ad7f600
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions examples/directx11_example/imgui_impl_dx11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ void ImGui_ImplDX11_NewFrame()
// io.MouseDown : filled by WM_*BUTTON* 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
ImGui::NewFrame();
}
3 changes: 3 additions & 0 deletions examples/directx9_example/imgui_impl_dx9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ void ImGui_ImplDX9_NewFrame()
// io.MouseDown : filled by WM_*BUTTON* 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
ImGui::NewFrame();
}
2 changes: 1 addition & 1 deletion examples/opengl3_example/imgui_impl_glfw_gl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ void ImGui_ImplGlfwGL3_NewFrame()
io.MouseWheel = g_MouseWheel;
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);

// Start the frame
Expand Down
2 changes: 1 addition & 1 deletion examples/opengl_example/imgui_impl_glfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void ImGui_ImplGlfw_NewFrame()
io.MouseWheel = g_MouseWheel;
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);

// Start the frame
Expand Down

0 comments on commit ad7f600

Please sign in to comment.