diff --git a/source/switch/imgui_deko3d.h b/source/switch/imgui_deko3d.h index 8874ecd..e47d135 100644 --- a/source/switch/imgui_deko3d.h +++ b/source/switch/imgui_deko3d.h @@ -20,6 +20,7 @@ #pragma once +#ifndef CLASSIC #include namespace imgui @@ -74,3 +75,4 @@ constexpr inline std::uint32_t align (T const &size_, U const &align_) } } } +#endif diff --git a/source/switch/imgui_nx.cpp b/source/switch/imgui_nx.cpp index b9246d7..2ae3186 100644 --- a/source/switch/imgui_nx.cpp +++ b/source/switch/imgui_nx.cpp @@ -1226,8 +1226,6 @@ void moveMouse (ImGuiIO &io_, ImVec2 const &pos_, bool const force_ = false) s_showMouse = true; s_lastMouseUpdate = now; s_mousePos = pos_; - - io_.MousePos = s_mousePos; } /// \brief Update mouse buttons @@ -1254,8 +1252,15 @@ void updateMousePos (ImGuiIO &io_) MousePosition pos; hidMouseRead (&pos); - io_.MouseWheelH += pos.scrollVelocityX; - io_.MouseWheel += pos.scrollVelocityY; + if (pos.scrollVelocityX > 0) + io_.MouseWheel += 1; + else if (pos.scrollVelocityX < 0) + io_.MouseWheel -= 1; + + if (pos.scrollVelocityY > 0) + io_.MouseWheelH += 1; + else if (pos.scrollVelocityY < 0) + io_.MouseWheelH -= 1; moveMouse ( io_, ImVec2 (s_mousePos.x + 2.0f * pos.velocityX, s_mousePos.y + 2.0f * pos.velocityY)); @@ -1504,6 +1509,7 @@ void imgui::nx::newFrame () // clamp mouse to screen s_mousePos.x = std::clamp (s_mousePos.x, 0.0f, s_width); s_mousePos.y = std::clamp (s_mousePos.y, 0.0f, s_height); + io.MousePos = s_mousePos; } void imgui::nx::exit () diff --git a/source/switch/imgui_nx.h b/source/switch/imgui_nx.h index a8ed0ae..ce401b1 100644 --- a/source/switch/imgui_nx.h +++ b/source/switch/imgui_nx.h @@ -20,13 +20,18 @@ #pragma once +#ifndef CLASSIC namespace imgui { namespace nx { +/// \brief Initialize switch platform bool init (); +/// \brief Deinitialize switch platform void exit (); +/// \brief Prepare switch for a new frame void newFrame (); } } +#endif