2019-11-27 06:34:01 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-11-27 06:34:01 +00:00
|
|
|
|
|
|
|
#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:
|
2021-03-05 18:33:46 +00:00
|
|
|
std::string GetName() const override;
|
2019-11-27 06:34:01 +00:00
|
|
|
Button(int pad_id, ButtonManager::ButtonType index) : m_pad_id(pad_id), m_index(index) {}
|
2021-03-05 18:33:46 +00:00
|
|
|
ControlState GetState() const override;
|
2019-11-27 06:34:01 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const int m_pad_id;
|
|
|
|
const ButtonManager::ButtonType m_index;
|
|
|
|
};
|
|
|
|
class Axis : public Input
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 18:33:46 +00:00
|
|
|
std::string GetName() const override;
|
2020-02-22 16:27:43 +00:00
|
|
|
bool IsDetectable() const override { return false; }
|
2019-11-27 06:34:01 +00:00
|
|
|
Axis(int pad_id, ButtonManager::ButtonType index, float neg = 1.0f)
|
|
|
|
: m_pad_id(pad_id), m_index(index), m_neg(neg)
|
|
|
|
{
|
|
|
|
}
|
2021-03-05 18:33:46 +00:00
|
|
|
ControlState GetState() const override;
|
2019-11-27 06:34:01 +00:00
|
|
|
|
|
|
|
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() {}
|
2021-03-05 18:33:46 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
std::string GetSource() const override;
|
2019-11-27 06:34:01 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const int m_pad_id;
|
|
|
|
};
|
|
|
|
} // namespace ciface::Touch
|