mirror of
https://github.com/niellun/FastCarPlay.git
synced 2026-06-11 02:47:47 +02:00
more buttons+multitouch
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user