diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2013-01-17 15:48:50 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2013-01-17 15:48:50 -0600 |
| commit | a01bd96d7d0bde0125ad3b13a6e6f6353fe1c8a0 (patch) | |
| tree | bfea2306c8379113f675ab920357f459db934ac2 /Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h | |
| parent | 69c91a20ea77bad0a9a1e10ab963c580908c3a45 (diff) | |
| parent | f97d2a93c4167a4b6aec0ae69536395380d427e3 (diff) | |
Merge branch 'full-analog-surface'
Fixes issue 5010.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h index 7c5a236d75..b846bb56e8 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h @@ -87,7 +87,7 @@ public: Input* ToInput() { return this; } }; - + // // Output // @@ -122,6 +122,36 @@ public: protected: void AddInput(Input* const i); void AddOutput(Output* const o); + + class FullAnalogSurface : public Input + { + public: + FullAnalogSurface(Input* low, Input* high) + : m_low(*low), m_high(*high) + {} + + ControlState GetState() const + { + return (1 + m_high.GetState() - m_low.GetState()) / 2; + } + + std::string GetName() const + { + return m_low.GetName() + *m_high.GetName().rbegin(); + } + + private: + Input& m_low; + Input& m_high; + }; + + void AddAnalogInputs(Input* low, Input* high) + { + AddInput(low); + AddInput(high); + AddInput(new FullAnalogSurface(low, high)); + AddInput(new FullAnalogSurface(high, low)); + } private: std::vector<Input*> m_inputs; |
