| 1161 | } |
| 1162 | |
| 1163 | void Console::commandTouchSubCommandTap(socket_native_type fd, std::string_view args) |
| 1164 | { |
| 1165 | auto argv = Console::Utility::split(args, ' '); |
| 1166 | |
| 1167 | if ((argv.size() == 3) && (Console::Utility::isFloat(argv[1]) && Console::Utility::isFloat(argv[2]))) |
| 1168 | { |
| 1169 | |
| 1170 | float x = (float)utils::atof(argv[1].c_str()); |
| 1171 | float y = (float)utils::atof(argv[2].c_str()); |
| 1172 | |
| 1173 | std::srand((unsigned)time(nullptr)); |
| 1174 | _touchId = rand(); |
| 1175 | Scheduler* sched = Director::getInstance()->getScheduler(); |
| 1176 | sched->runOnAxmolThread([&]() { |
| 1177 | Director::getInstance()->getRenderView()->handleTouchesBegin(1, &_touchId, &x, &y); |
| 1178 | Director::getInstance()->getRenderView()->handleTouchesEnd(1, &_touchId, &x, &y); |
| 1179 | }); |
| 1180 | } |
| 1181 | else |
| 1182 | { |
| 1183 | const char msg[] = "touch: invalid arguments.\n"; |
| 1184 | Console::Utility::sendToConsole(fd, msg, strlen(msg)); |
| 1185 | } |
| 1186 | } |
| 1187 | |
| 1188 | void Console::commandTouchSubCommandSwipe(socket_native_type fd, std::string_view args) |
| 1189 | { |
nothing calls this directly
no test coverage detected