InputCommon: follow coding conventions
This commit is contained in:
parent
4625359a4f
commit
5f74d0e08f
|
@ -247,22 +247,18 @@ ParseStatus Lexer::Tokenize(std::vector<Token>& tokens)
|
||||||
class ControlExpression : public Expression
|
class ControlExpression : public Expression
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Keep a shared_ptr to the device so the control pointer doesn't become invalid.
|
explicit ControlExpression(ControlQualifier qualifier) : m_qualifier(qualifier) {}
|
||||||
std::shared_ptr<Device> m_device;
|
|
||||||
|
|
||||||
explicit ControlExpression(ControlQualifier qualifier_) : qualifier(qualifier_) {}
|
|
||||||
|
|
||||||
ControlState GetValue() const override
|
ControlState GetValue() const override
|
||||||
{
|
{
|
||||||
if (s_hotkey_suppressions.IsSuppressed(input))
|
if (s_hotkey_suppressions.IsSuppressed(m_input))
|
||||||
return 0;
|
return 0;
|
||||||
else
|
|
||||||
return GetValueIgnoringSuppression();
|
return GetValueIgnoringSuppression();
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlState GetValueIgnoringSuppression() const
|
ControlState GetValueIgnoringSuppression() const
|
||||||
{
|
{
|
||||||
if (!input)
|
if (!m_input)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
// Note: Inputs may return negative values in situations where opposing directions are
|
// Note: Inputs may return negative values in situations where opposing directions are
|
||||||
|
@ -271,27 +267,29 @@ public:
|
||||||
// FYI: Clamping values greater than 1.0 is purposely not done to support unbounded values in
|
// FYI: Clamping values greater than 1.0 is purposely not done to support unbounded values in
|
||||||
// the future. (e.g. raw accelerometer/gyro data)
|
// the future. (e.g. raw accelerometer/gyro data)
|
||||||
|
|
||||||
return std::max(0.0, input->GetState());
|
return std::max(0.0, m_input->GetState());
|
||||||
}
|
}
|
||||||
void SetValue(ControlState value) override
|
void SetValue(ControlState value) override
|
||||||
{
|
{
|
||||||
if (output)
|
if (m_output)
|
||||||
output->SetState(value);
|
m_output->SetState(value);
|
||||||
}
|
}
|
||||||
int CountNumControls() const override { return (input || output) ? 1 : 0; }
|
int CountNumControls() const override { return (m_input || m_output) ? 1 : 0; }
|
||||||
void UpdateReferences(ControlEnvironment& env) override
|
void UpdateReferences(ControlEnvironment& env) override
|
||||||
{
|
{
|
||||||
m_device = env.FindDevice(qualifier);
|
m_device = env.FindDevice(m_qualifier);
|
||||||
input = env.FindInput(qualifier);
|
m_input = env.FindInput(m_qualifier);
|
||||||
output = env.FindOutput(qualifier);
|
m_output = env.FindOutput(m_qualifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
Device::Input* GetInput() const { return input; };
|
Device::Input* GetInput() const { return m_input; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ControlQualifier qualifier;
|
// Keep a shared_ptr to the device so the control pointer doesn't become invalid.
|
||||||
Device::Input* input = nullptr;
|
std::shared_ptr<Device> m_device;
|
||||||
Device::Output* output = nullptr;
|
ControlQualifier m_qualifier;
|
||||||
|
Device::Input* m_input = nullptr;
|
||||||
|
Device::Output* m_output = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool HotkeySuppressions::IsSuppressedIgnoringModifiers(Device::Input* input,
|
bool HotkeySuppressions::IsSuppressedIgnoringModifiers(Device::Input* input,
|
||||||
|
|
Loading…
Reference in New Issue