3
3
#include < array>
4
4
#include < cmath>
5
5
#include < ranges>
6
+ #include < format>
6
7
7
- #include " Utils/Format.hpp"
8
8
#include " Utils/Logger.h"
9
9
10
10
MAA_CTRL_UNIT_NS_BEGIN
@@ -70,8 +70,8 @@ bool MtouchHelper::click(int x, int y)
70
70
71
71
LogInfo << VAR (x) << VAR (y) << VAR (touch_x) << VAR (touch_y);
72
72
73
- bool ret = pipe_ios_->write (MAA_FMT ::format (kDownFormat , 0 , touch_x, touch_y, press_)) &&
74
- pipe_ios_->write (MAA_FMT ::format (kUpFormat , 0 ));
73
+ bool ret = pipe_ios_->write (std ::format (kDownFormat , 0 , touch_x, touch_y, press_)) &&
74
+ pipe_ios_->write (std ::format (kUpFormat , 0 ));
75
75
76
76
if (!ret) {
77
77
LogError << " failed to write" ;
@@ -110,7 +110,7 @@ bool MtouchHelper::swipe(int x1, int y1, int x2, int y2, int duration)
110
110
auto start = std::chrono::steady_clock::now ();
111
111
auto now = start;
112
112
bool ret = true ;
113
- ret &= pipe_ios_->write (MAA_FMT ::format (kDownFormat , 0 , touch_x1, touch_y1, press_));
113
+ ret &= pipe_ios_->write (std ::format (kDownFormat , 0 , touch_x1, touch_y1, press_));
114
114
if (!ret) {
115
115
LogError << " write error" ;
116
116
return false ;
@@ -127,19 +127,19 @@ bool MtouchHelper::swipe(int x1, int y1, int x2, int y2, int duration)
127
127
std::this_thread::sleep_until (now + delay);
128
128
now = std::chrono::steady_clock::now ();
129
129
130
- ret &= pipe_ios_->write (MAA_FMT ::format (kMoveFormat , 0 , tx, ty, press_));
130
+ ret &= pipe_ios_->write (std ::format (kMoveFormat , 0 , tx, ty, press_));
131
131
if (!ret) {
132
132
LogWarn << " write error" ;
133
133
}
134
134
}
135
135
136
136
std::this_thread::sleep_until (now + delay);
137
137
now = std::chrono::steady_clock::now ();
138
- ret &= pipe_ios_->write (MAA_FMT ::format (kMoveFormat , 0 , touch_x2, touch_y2, press_));
138
+ ret &= pipe_ios_->write (std ::format (kMoveFormat , 0 , touch_x2, touch_y2, press_));
139
139
140
140
std::this_thread::sleep_until (now + delay);
141
141
now = std::chrono::steady_clock::now ();
142
- ret &= pipe_ios_->write (MAA_FMT ::format (kUpFormat , 0 ));
142
+ ret &= pipe_ios_->write (std ::format (kUpFormat , 0 ));
143
143
144
144
if (!ret) {
145
145
LogError << " failed to write" ;
@@ -160,7 +160,7 @@ bool MtouchHelper::touch_down(int contact, int x, int y, int pressure)
160
160
161
161
LogInfo << VAR (contact) << VAR (x) << VAR (y) << VAR (touch_x) << VAR (touch_y);
162
162
163
- bool ret = pipe_ios_->write (MAA_FMT ::format (kDownFormat , contact, touch_x, touch_y, pressure));
163
+ bool ret = pipe_ios_->write (std ::format (kDownFormat , contact, touch_x, touch_y, pressure));
164
164
165
165
if (!ret) {
166
166
LogError << " failed to write" ;
@@ -181,7 +181,7 @@ bool MtouchHelper::touch_move(int contact, int x, int y, int pressure)
181
181
182
182
LogInfo << VAR (contact) << VAR (x) << VAR (y) << VAR (touch_x) << VAR (touch_y);
183
183
184
- bool ret = pipe_ios_->write (MAA_FMT ::format (kMoveFormat , contact, touch_x, touch_y, pressure));
184
+ bool ret = pipe_ios_->write (std ::format (kMoveFormat , contact, touch_x, touch_y, pressure));
185
185
186
186
if (!ret) {
187
187
LogError << " failed to write" ;
@@ -200,7 +200,7 @@ bool MtouchHelper::touch_up(int contact)
200
200
201
201
LogInfo << VAR (contact);
202
202
203
- bool ret = pipe_ios_->write (MAA_FMT ::format (kUpFormat , contact));
203
+ bool ret = pipe_ios_->write (std ::format (kUpFormat , contact));
204
204
205
205
if (!ret) {
206
206
LogError << " failed to write" ;
0 commit comments