diff options
Diffstat (limited to 'proto-vjoystick/vjoystick.h')
-rw-r--r-- | proto-vjoystick/vjoystick.h | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h index 96d10e9e..7e119b21 100644 --- a/proto-vjoystick/vjoystick.h +++ b/proto-vjoystick/vjoystick.h @@ -10,45 +10,32 @@ #include "api/plugin-api.hpp" #include "compat/macros.hpp" -#include <optional> - -enum class state : int +enum status { - notent = -1, - fail = -2, - success = 1, }; -class handle final +class vjoystick : public TR, public IProtocol { + Q_OBJECT + public: - static constexpr unsigned axis_count = 6; - static const unsigned char axis_ids[axis_count]; + vjoystick(); + ~vjoystick() override; + module_status initialize() override; + void pose( const double *headpose ) override; + QString game_name() override { return tr("Virtual joystick"); } private: - state joy_state = state::notent; long axis_min[6] {}; long axis_max[6] {}; [[nodiscard]] bool init(); -public: - handle(); - ~handle(); - state get_state() const { return joy_state; } - [[nodiscard]] bool to_axis_value(unsigned axis_id, double val, int& ret) const; -}; + int to_axis_value(unsigned axis_id, double val) const; -class vjoystick_proto : public TR, public IProtocol -{ - Q_OBJECT + static constexpr unsigned axis_count = 6; + static const unsigned char axis_ids[axis_count]; - std::optional<handle> h; -public: - vjoystick_proto(); - ~vjoystick_proto() override; - module_status initialize() override; - void pose( const double *headpose ) override; - QString game_name() override { return tr("Virtual joystick"); } -private: + bool status = false; + bool first_run = true; }; class vjoystick_dialog final : public IProtocolDialog |