ControlGroup/Triggers: Return state data by value

Makes it less error-prone to get state data from analog sticks (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
This commit is contained in:
Lioncash
2018-07-13 12:06:49 -04:00
parent 97ba02df27
commit cfe7549091
4 changed files with 23 additions and 13 deletions

View File

@ -5,6 +5,8 @@
#pragma once
#include <string>
#include <vector>
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
#include "InputCommon/ControllerInterface/Device.h"
@ -13,8 +15,16 @@ namespace ControllerEmu
class Triggers : public ControlGroup
{
public:
struct StateData
{
StateData() = default;
explicit StateData(std::size_t trigger_count) : data(trigger_count) {}
std::vector<ControlState> data;
};
explicit Triggers(const std::string& name);
void GetState(ControlState* analog);
StateData GetState();
};
} // namespace ControllerEmu