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