mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user