summaryrefslogtreecommitdiffstats
path: root/src/input_common/udp/udp.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-09-17 21:39:01 +0200
committerGitHub <noreply@github.com>2020-09-17 21:39:01 +0200
commit3f6d83b27cf3eb2e782185deeb852630037caa17 (patch)
treefebd2fb00d95ed955be4ed97acc9f4c21b2a5efa /src/input_common/udp/udp.h
parentMerge pull request #4668 from lioncash/port (diff)
parentconfigure_input: Hook up the motion button and checkbox (diff)
downloadyuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.tar
yuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.tar.gz
yuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.tar.bz2
yuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.tar.lz
yuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.tar.xz
yuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.tar.zst
yuzu-3f6d83b27cf3eb2e782185deeb852630037caa17.zip
Diffstat (limited to 'src/input_common/udp/udp.h')
-rw-r--r--src/input_common/udp/udp.h61
1 files changed, 43 insertions, 18 deletions
diff --git a/src/input_common/udp/udp.h b/src/input_common/udp/udp.h
index 672a5c812..ea3fd4175 100644
--- a/src/input_common/udp/udp.h
+++ b/src/input_common/udp/udp.h
@@ -1,32 +1,57 @@
-// Copyright 2018 Citra Emulator Project
+// Copyright 2020 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <memory>
-#include <vector>
-#include "common/param_package.h"
+#include "core/frontend/input.h"
+#include "input_common/udp/client.h"
-namespace InputCommon::CemuhookUDP {
+namespace InputCommon {
-class Client;
-class UDPMotionFactory;
-class UDPTouchFactory;
-
-class State {
+/// A motion device factory that creates motion devices from udp clients
+class UDPMotionFactory final : public Input::Factory<Input::MotionDevice> {
public:
- State();
- ~State();
- void ReloadUDPClient();
- std::vector<Common::ParamPackage> GetInputDevices() const;
+ explicit UDPMotionFactory(std::shared_ptr<CemuhookUDP::Client> client_);
+
+ std::unique_ptr<Input::MotionDevice> Create(const Common::ParamPackage& params) override;
+
+ Common::ParamPackage GetNextInput();
+
+ /// For device input configuration/polling
+ void BeginConfiguration();
+ void EndConfiguration();
+
+ bool IsPolling() const {
+ return polling;
+ }
private:
- std::unique_ptr<Client> client;
- std::shared_ptr<UDPMotionFactory> motion_factory;
- std::shared_ptr<UDPTouchFactory> touch_factory;
+ std::shared_ptr<CemuhookUDP::Client> client;
+ bool polling = false;
};
-std::unique_ptr<State> Init();
+/// A touch device factory that creates touch devices from udp clients
+class UDPTouchFactory final : public Input::Factory<Input::TouchDevice> {
+public:
+ explicit UDPTouchFactory(std::shared_ptr<CemuhookUDP::Client> client_);
+
+ std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override;
+
+ Common::ParamPackage GetNextInput();
+
+ /// For device input configuration/polling
+ void BeginConfiguration();
+ void EndConfiguration();
+
+ bool IsPolling() const {
+ return polling;
+ }
+
+private:
+ std::shared_ptr<CemuhookUDP::Client> client;
+ bool polling = false;
+};
-} // namespace InputCommon::CemuhookUDP
+} // namespace InputCommon