summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControlReference/ControlReference.h
diff options
context:
space:
mode:
authorMat M <mathew1800@gmail.com>2017-02-08 20:01:18 -0500
committerGitHub <noreply@github.com>2017-02-08 20:01:18 -0500
commit73382852b7636642d6614d7b7919ee6173dfe71f (patch)
tree3b0a26314cb87c4b905c97988fa310b9b4fe569f /Source/Core/InputCommon/ControlReference/ControlReference.h
parent17e4b450fbc35cb3fb44c3a3a93203c59650072a (diff)
parent2d51bf579f4c782951a3b9e7cd40327cdeb8b6b6 (diff)
Merge pull request #4502 from ligfx/extractcontrolreference
InputCommon: Extract ControlReference from ControllerInterface
Diffstat (limited to 'Source/Core/InputCommon/ControlReference/ControlReference.h')
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.h b/Source/Core/InputCommon/ControlReference/ControlReference.h
new file mode 100644
index 0000000000..e7e6e1a277
--- /dev/null
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.h
@@ -0,0 +1,74 @@
+// Copyright 2016 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+
+#include "InputCommon/ControlReference/ExpressionParser.h"
+#include "InputCommon/ControllerInterface/Device.h"
+
+// ControlReference
+//
+// These are what you create to actually use the inputs, InputReference or OutputReference.
+//
+// After being bound to devices and controls with UpdateReference,
+// each one can link to multiple devices and controls
+// when you change a ControlReference's expression,
+// you must use UpdateReference on it to rebind controls
+//
+
+class ControlReference
+{
+public:
+ static bool InputGateOn();
+
+ virtual ControlState State(const ControlState state = 0) = 0;
+ virtual ciface::Core::Device::Control* Detect(const unsigned int ms,
+ ciface::Core::Device* const device) = 0;
+ virtual bool IsInput() const = 0;
+
+ int BoundCount() const;
+ ciface::ExpressionParser::ExpressionParseStatus GetParseStatus() const;
+ void UpdateReference(ciface::Core::DeviceContainer& devices,
+ const ciface::Core::DeviceQualifier& default_device);
+
+ ControlState range;
+ std::string expression;
+
+protected:
+ ControlReference();
+ std::unique_ptr<ciface::ExpressionParser::Expression> m_parsed_expression;
+ ciface::ExpressionParser::ExpressionParseStatus m_parse_status;
+};
+
+//
+// InputReference
+//
+// Control reference for inputs
+//
+class InputReference : public ControlReference
+{
+public:
+ InputReference();
+ bool IsInput() const override;
+ ControlState State(const ControlState state) override;
+ ciface::Core::Device::Control* Detect(const unsigned int ms,
+ ciface::Core::Device* const device) override;
+};
+
+//
+// OutputReference
+//
+// Control reference for outputs
+//
+class OutputReference : public ControlReference
+{
+public:
+ OutputReference();
+ bool IsInput() const override;
+ ControlState State(const ControlState state) override;
+ ciface::Core::Device::Control* Detect(const unsigned int ms,
+ ciface::Core::Device* const device) override;
+};