more buttons+multitouch

This commit is contained in:
frederik
2026-01-06 14:08:06 +01:00
committed by Alexander
parent 2b96660d32
commit 0d7fa30b8a
5 changed files with 84 additions and 0 deletions
+22
View File
@@ -153,6 +153,28 @@ void Protocol::sendClick(float x, float y, bool down)
send(CMD_TOUCH, false, buf, 16);
}
void Protocol::sendMultiTouch(const std::vector<Protocol::Touch>& touches)
{
if (touches.empty()) return;
const size_t touchSize = 16;
const size_t totalSize = touches.size() * touchSize;
std::vector<uint8_t> buf(totalSize);
uint8_t* p = buf.data();
for (const auto& t : touches) {
write_float_le(p + 0, t.x);
write_float_le(p + 4, t.y);
write_uint32_le(p + 8, static_cast<uint32_t>(t.action));
write_uint32_le(p + 12, t.id);
p += touchSize;
}
send(CMD_MULTI_TOUCH, false, buf.data(), totalSize);
}
void Protocol::sendMove(float dx, float dy)
{
uint8_t buf[16];