2014-02-10 18:54:46 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-02-10 18:54:46 +00:00
|
|
|
// Refer to the license.txt file included.
|
2013-04-15 04:02:53 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "InputCommon/ControllerInterface/Android/Android.h"
|
2016-06-12 15:08:04 +00:00
|
|
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
2019-11-27 06:34:01 +00:00
|
|
|
#include "InputCommon/ControllerInterface/Touch/Touchscreen.h"
|
2013-04-15 04:02:53 +00:00
|
|
|
|
2019-06-17 20:39:24 +00:00
|
|
|
namespace ciface::Android
|
2013-04-15 04:02:53 +00:00
|
|
|
{
|
2019-11-20 18:40:47 +00:00
|
|
|
static bool s_accelerometer_enabled = false;
|
|
|
|
static bool s_gyroscope_enabled = false;
|
|
|
|
|
|
|
|
void SetMotionSensorsEnabled(bool accelerometer_enabled, bool gyroscope_enabled)
|
|
|
|
{
|
|
|
|
const bool any_changes =
|
|
|
|
s_accelerometer_enabled != accelerometer_enabled || s_gyroscope_enabled != gyroscope_enabled;
|
|
|
|
|
|
|
|
s_accelerometer_enabled = accelerometer_enabled;
|
|
|
|
s_gyroscope_enabled = gyroscope_enabled;
|
|
|
|
|
|
|
|
if (any_changes)
|
|
|
|
g_controller_interface.RefreshDevices();
|
|
|
|
}
|
|
|
|
|
2016-10-16 20:39:05 +00:00
|
|
|
void PopulateDevices()
|
2013-04-15 04:02:53 +00:00
|
|
|
{
|
2016-06-12 15:08:04 +00:00
|
|
|
for (int i = 0; i < 8; ++i)
|
2019-11-27 06:34:01 +00:00
|
|
|
g_controller_interface.AddDevice(std::make_shared<ciface::Touch::Touchscreen>(
|
|
|
|
i, s_accelerometer_enabled, s_gyroscope_enabled));
|
2018-09-02 20:55:22 +00:00
|
|
|
}
|
2019-06-17 20:39:24 +00:00
|
|
|
} // namespace ciface::Android
|