mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-10 15:05:10 +01:00
Minor mouse fixes
This commit is contained in:
parent
214ab229c6
commit
a313c5c169
@ -20,6 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef CLASSIC
|
||||
#include <deko3d.hpp>
|
||||
|
||||
namespace imgui
|
||||
@ -74,3 +75,4 @@ constexpr inline std::uint32_t align (T const &size_, U const &align_)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -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 ()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user