Browse Source

Merge branch 'Gargaj-patch-1'

pull/1692/head
omar 7 years ago
parent
commit
cb10da02f9
  1. 29
      examples/directx10_example/imgui_impl_dx10.cpp
  2. 29
      examples/directx11_example/imgui_impl_dx11.cpp
  3. 30
      examples/directx9_example/imgui_impl_dx9.cpp

29
examples/directx10_example/imgui_impl_dx10.cpp

@ -225,28 +225,43 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
}
IMGUI_API LRESULT ImGui_ImplDX10_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
static bool IsAnyMouseButtonDown()
{
ImGuiIO& io = ImGui::GetIO();
for (int n = 0; n < ARRAYSIZE(io.MouseDown); n++)
if (io.MouseDown[n])
return true;
return false;
}
IMGUI_API LRESULT ImGui_ImplDX10_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ImGuiIO& io = ImGui::GetIO();
switch (msg)
{
case WM_LBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[0] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
return true;
case WM_RBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[1] = true;
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
return true;
case WM_MBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[2] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_MBUTTONUP:
io.MouseDown[2] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_MOUSEWHEEL:
io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f;

29
examples/directx11_example/imgui_impl_dx11.cpp

@ -232,28 +232,43 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
}
IMGUI_API LRESULT ImGui_ImplDX11_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
static bool IsAnyMouseButtonDown()
{
ImGuiIO& io = ImGui::GetIO();
for (int n = 0; n < ARRAYSIZE(io.MouseDown); n++)
if (io.MouseDown[n])
return true;
return false;
}
IMGUI_API LRESULT ImGui_ImplDX11_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ImGuiIO& io = ImGui::GetIO();
switch (msg)
{
case WM_LBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[0] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
return true;
case WM_RBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[1] = true;
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
return true;
case WM_MBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[2] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_MBUTTONUP:
io.MouseDown[2] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_MOUSEWHEEL:
io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f;

30
examples/directx9_example/imgui_impl_dx9.cpp

@ -171,28 +171,44 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
d3d9_state_block->Release();
}
IMGUI_API LRESULT ImGui_ImplDX9_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
static bool IsAnyMouseButtonDown()
{
ImGuiIO& io = ImGui::GetIO();
for (int n = 0; n < ARRAYSIZE(io.MouseDown); n++)
if (io.MouseDown[n])
return true;
return false;
}
// We use Win32 SetCapture/ReleaseCapture() API to enable reading the mouse outside our Windows bounds.
IMGUI_API LRESULT ImGui_ImplDX9_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ImGuiIO& io = ImGui::GetIO();
switch (msg)
{
case WM_LBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[0] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
return true;
case WM_RBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[1] = true;
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
return true;
case WM_MBUTTONDOWN:
if (!IsAnyMouseButtonDown()) ::SetCapture(hwnd);
io.MouseDown[2] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_MBUTTONUP:
io.MouseDown[2] = false;
if (!IsAnyMouseButtonDown()) ::ReleaseCapture();
return true;
case WM_MOUSEWHEEL:
io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f;

Loading…
Cancel
Save