input_common: touch: Rewrite touch driver to support multiple touch points

This commit is contained in:
german77 2022-05-22 20:34:32 -05:00 committed by Narr the Reg
parent 4eb7f6c044
commit c82806f9cb
8 changed files with 140 additions and 92 deletions

View file

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <random>
#include "common/input.h"
@ -196,6 +197,9 @@ Common::Input::TouchStatus TransformToTouch(const Common::Input::CallbackStatus&
x = std::clamp(x, 0.0f, 1.0f);
y = std::clamp(y, 0.0f, 1.0f);
// Limit id to maximum number of fingers
status.id = std::clamp(status.id, 0, 16);
if (status.pressed.inverted) {
status.pressed.value = !status.pressed.value;
}