summaryrefslogtreecommitdiffhomepage
path: root/proto-vjoystick/vjoystick.h
diff options
context:
space:
mode:
Diffstat (limited to 'proto-vjoystick/vjoystick.h')
-rw-r--r--proto-vjoystick/vjoystick.h48
1 files changed, 17 insertions, 31 deletions
diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h
index 81f70a7f..7e119b21 100644
--- a/proto-vjoystick/vjoystick.h
+++ b/proto-vjoystick/vjoystick.h
@@ -10,46 +10,32 @@
#include "api/plugin-api.hpp"
#include "compat/macros.hpp"
-#include <windows.h>
-
-enum state : signed char
-{
- state_notent = -1,
- state_fail = -2,
- state_success = 1,
-};
-
-class handle final
+enum status
{
-public:
- static constexpr unsigned axis_count = 6;
- static const unsigned char axis_ids[axis_count];
-
-private:
- state joy_state;
- LONG axis_min[6] {};
- LONG axis_max[6] {};
-
- void init();
-public:
- handle();
- ~handle();
- state get_state() { return joy_state; }
- LONG to_axis_value(unsigned axis_id, double val);
};
-class vjoystick_proto : public TR, public IProtocol
+class vjoystick : public TR, public IProtocol
{
Q_OBJECT
- handle h;
public:
- vjoystick_proto();
- ~vjoystick_proto() override;
+ vjoystick();
+ ~vjoystick() override;
module_status initialize() override;
void pose( const double *headpose ) override;
QString game_name() override { return tr("Virtual joystick"); }
+
private:
+ long axis_min[6] {};
+ long axis_max[6] {};
+ [[nodiscard]] bool init();
+ int to_axis_value(unsigned axis_id, double val) const;
+
+ static constexpr unsigned axis_count = 6;
+ static const unsigned char axis_ids[axis_count];
+
+ bool status = false;
+ bool first_run = true;
};
class vjoystick_dialog final : public IProtocolDialog
@@ -68,6 +54,6 @@ class vjoystick_metadata : public Metadata
{
Q_OBJECT
- QString name() { return tr("Joystick emulation -- vjoystick"); }
- QIcon icon() { return QIcon(":/images/vjoystick.png"); }
+ QString name() override { return tr("Joystick emulation -- vjoystick"); }
+ QIcon icon() override { return QIcon(":/images/vjoystick.png"); }
};