dolphin/Source/Core/InputCommon/ControllerInterface/Touch/Touchscreen.h
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00

64 lines
1.7 KiB
C++

// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "InputCommon/ControllerInterface/Touch/ButtonManager.h"
namespace ciface::Touch
{
class Touchscreen : public Core::Device
{
private:
class Button : public Input
{
public:
std::string GetName() const override;
Button(int pad_id, ButtonManager::ButtonType index) : m_pad_id(pad_id), m_index(index) {}
ControlState GetState() const override;
private:
const int m_pad_id;
const ButtonManager::ButtonType m_index;
};
class Axis : public Input
{
public:
std::string GetName() const override;
bool IsDetectable() const override { return false; }
Axis(int pad_id, ButtonManager::ButtonType index, float neg = 1.0f)
: m_pad_id(pad_id), m_index(index), m_neg(neg)
{
}
ControlState GetState() const override;
private:
const int m_pad_id;
const ButtonManager::ButtonType m_index;
const float m_neg;
};
class Motor : public Core::Device::Output
{
public:
Motor(int pad_id, ButtonManager::ButtonType index) : m_pad_id(pad_id), m_index(index) {}
~Motor();
std::string GetName() const override;
void SetState(ControlState state) override;
private:
const int m_pad_id;
const ButtonManager::ButtonType m_index;
static void Rumble(int pad_id, double state);
};
public:
Touchscreen(int pad_id, bool accelerometer_enabled, bool gyroscope_enabled);
~Touchscreen() {}
std::string GetName() const override;
std::string GetSource() const override;
private:
const int m_pad_id;
};
} // namespace ciface::Touch