From c342db9623f9f21451dce73e27bd21d24579b40a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 2 Jul 2018 03:31:07 +0200 Subject: proto/vjoystick: untested but likely works --- proto-vjoystick/vjoystick.h | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 proto-vjoystick/vjoystick.h (limited to 'proto-vjoystick/vjoystick.h') diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h new file mode 100644 index 00000000..6d4062f0 --- /dev/null +++ b/proto-vjoystick/vjoystick.h @@ -0,0 +1,68 @@ +/* Copyright (c) 2016, Stanislaw Halik + + * Permission to use, copy, modify, and/or distribute this + * software for any purpose with or without fee is hereby granted, + * provided that the above copyright notice and this permission + * notice appear in all copies. + */ +#pragma once +#include "ui_vjoystick.h" +#include "opentrack/plugin-api.hpp" + +#include +#include + +#include + +enum state : signed char +{ + state_notent = -1, + state_fail = -2, + state_success = 1, +}; + +class handle final +{ + 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 QObject, public IProtocol +{ + Q_OBJECT + + handle h; +public: + vjoystick_proto(); + ~vjoystick_proto() override; + bool correct() override; + void pose( const double *headpose ) override; + QString game_name() override { return tr("Virtual joystick"); } +private: +}; + +class vjoystick_dialog final : public IProtocolDialog +{ + Q_OBJECT +public: + + vjoystick_dialog(); + void register_protocol(IProtocol *) override {} + void unregister_protocol() override {} +private: + Ui::vjoystick ui; +}; + +class vjoystick_metadata : public Metadata +{ + QString name() override { return "Joystick emulation -- vjoystick"; } + QIcon icon() override { return QIcon(":/images/vjoystick.png"); } +}; -- cgit v1.2.3