ControlGroup/Tilt: Return state data by value

Makes it less error-prone to get state data from tilt controls (no need
to pass any pointers to locals), and also allows direct assignment,
letting the retrieved data be const.
This commit is contained in:
Lioncash
2018-07-13 11:04:40 -04:00
parent 918d448b5b
commit 97ba02df27
3 changed files with 28 additions and 28 deletions

View File

@ -4,7 +4,6 @@
#pragma once
#include <array>
#include <string>
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
#include "InputCommon/ControllerInterface/Device.h"
@ -14,11 +13,17 @@ namespace ControllerEmu
class Tilt : public ControlGroup
{
public:
struct StateData
{
ControlState x{};
ControlState y{};
};
explicit Tilt(const std::string& name);
void GetState(ControlState* x, ControlState* y, bool step = true);
StateData GetState(bool step = true);
private:
std::array<ControlState, 2> m_tilt{};
StateData m_tilt;
};
} // namespace ControllerEmu