chore: Add trace log for scaled coordinates in ControlScaleProxy click & swipe

This commit is contained in:
uye
2024-06-01 00:18:31 +08:00
parent 10dd024bcf
commit 3fa6e72604
3 changed files with 8 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
#include "ControlScaleProxy.h"
#include "Config/GeneralConfig.h"
#include "Utils/Logger.hpp"
asst::ControlScaleProxy::ControlScaleProxy(std::shared_ptr<ControllerAPI> controller, ControllerType controller_type,
ProxyCallback proxy_callback)
@@ -56,6 +57,8 @@ bool asst::ControlScaleProxy::click(const Point& p)
int x = static_cast<int>(p.x * m_control_scale);
int y = static_cast<int>(p.y * m_control_scale);
Log.trace("Click with scaled coordinates", p, m_control_scale);
return m_controller->click(Point(x, y));
}
@@ -72,6 +75,8 @@ bool asst::ControlScaleProxy::swipe(const Point& p1, const Point& p2, int durati
int x2 = static_cast<int>(p2.x * m_control_scale);
int y2 = static_cast<int>(p2.y * m_control_scale);
Log.trace("Swipe with scaled coordinates", p1, p2, m_control_scale);
return m_controller->swipe(Point(x1, y1), Point(x2, y2), duration, extra_swipe, slope_in, slope_out, with_pause);
}

View File

@@ -130,7 +130,6 @@ bool asst::MinitouchController::use_swipe_with_pause() const noexcept
bool asst::MinitouchController::click(const Point& p)
{
if (!m_minitoucher) {
Log.error("minitoucher is not initialized");
return false;

View File

@@ -118,6 +118,7 @@ bool asst::PlayToolsController::stop_game()
bool asst::PlayToolsController::click(const Point& p)
{
Log.trace("PlayTools click:", p);
return toucher_down(p) && toucher_up(p);
}
@@ -143,6 +144,8 @@ bool asst::PlayToolsController::swipe(
y1 = std::clamp(y1, 0, height - 1);
}
Log.trace("PlayTools swipe", p1, p2, duration, extra_swipe, slope_in, slope_out);
toucher_down(p1);
auto cubic_spline = [](double slope_0, double slope_1, double t) {