diff options
Diffstat (limited to 'proto-mouse')
-rw-r--r-- | proto-mouse/ftnoir_mousecontrols.ui | 201 | ||||
-rw-r--r-- | proto-mouse/ftnoir_protocol_mouse.cpp | 85 | ||||
-rw-r--r-- | proto-mouse/ftnoir_protocol_mouse.h | 45 | ||||
-rw-r--r-- | proto-mouse/ftnoir_protocol_mouse_dialog.cpp | 19 | ||||
-rw-r--r-- | proto-mouse/lang/nl_NL.ts | 44 | ||||
-rw-r--r-- | proto-mouse/lang/ru_RU.ts | 44 | ||||
-rw-r--r-- | proto-mouse/lang/stub.ts | 44 | ||||
-rw-r--r-- | proto-mouse/lang/zh_CN.ts | 60 | ||||
-rw-r--r-- | proto-mouse/mouse-settings.hpp | 24 |
9 files changed, 321 insertions, 245 deletions
diff --git a/proto-mouse/ftnoir_mousecontrols.ui b/proto-mouse/ftnoir_mousecontrols.ui index f970f887..45b33470 100644 --- a/proto-mouse/ftnoir_mousecontrols.ui +++ b/proto-mouse/ftnoir_mousecontrols.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>UICMOUSEControls</class> - <widget class="QWidget" name="UICMOUSEControls"> + <class>UI_mouse</class> + <widget class="QWidget" name="UI_mouse"> <property name="windowModality"> <enum>Qt::NonModal</enum> </property> @@ -9,70 +9,42 @@ <rect> <x>0</x> <y>0</y> - <width>413</width> - <height>155</height> + <width>360</width> + <height>146</height> </rect> </property> <property name="minimumSize"> <size> - <width>413</width> + <width>360</width> <height>0</height> </size> </property> <property name="windowTitle"> - <string>Mouse protocol settings</string> + <string>Mouse protocol</string> </property> <property name="windowIcon"> <iconset resource="win32-mouse-protocol.qrc"> <normaloff>:/images/mouse.png</normaloff>:/images/mouse.png</iconset> </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QFormLayout" name="formLayout"> + <property name="leftMargin"> + <number>9</number> + </property> + <property name="topMargin"> + <number>11</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> <item row="0" column="0"> <widget class="QLabel" name="textLabel2_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Map mouse X to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="text"> - <string>Map mouse Y to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> + <string>X axis</string> </property> </widget> </item> - <item row="0" column="1" colspan="2"> - <widget class="QComboBox" name="cbxSelectMouse_X"> + <item row="0" column="1"> + <widget class="QComboBox" name="axis_x"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -81,16 +53,10 @@ </property> <property name="maximumSize"> <size> - <width>80</width> + <width>105</width> <height>16777215</height> </size> </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> <item> <property name="text"> <string>None</string> @@ -128,8 +94,38 @@ </item> </widget> </item> - <item row="1" column="1" colspan="2"> - <widget class="QComboBox" name="cbxSelectMouse_Y"> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2_6"> + <property name="text"> + <string>Sensitivity</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSlider" name="sensitivity_x"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="textLabel2_3"> + <property name="text"> + <string>Y axis</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="axis_y"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -138,16 +134,10 @@ </property> <property name="maximumSize"> <size> - <width>80</width> + <width>105</width> <height>16777215</height> </size> </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> <item> <property name="text"> <string>None</string> @@ -185,36 +175,17 @@ </item> </widget> </item> - <item row="4" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="textLabel2_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <item row="3" column="0"> + <widget class="QLabel" name="textLabel2_7"> <property name="text"> - <string>X axis sensitivity</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> + <string>Sensitivity</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QSlider" name="sensitivity_x"> + <item row="3" column="1"> + <widget class="QSlider" name="sensitivity_y"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -227,38 +198,49 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="textLabel2_5"> + <item row="4" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Method</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="input_method"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Y axis sensitivity</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> + <property name="maximumSize"> + <size> + <width>105</width> + <height>16777215</height> + </size> </property> + <item> + <property name="text"> + <string>Direct input</string> + </property> + </item> + <item> + <property name="text"> + <string>Legacy</string> + </property> + </item> </widget> </item> - <item row="3" column="1"> - <widget class="QSlider" name="sensitivity_y"> + <item row="5" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickInterval"> - <number>25</number> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> @@ -268,9 +250,4 @@ <include location="win32-mouse-protocol.qrc"/> </resources> <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> </ui> diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp index b4b27ea9..e5b2192b 100644 --- a/proto-mouse/ftnoir_protocol_mouse.cpp +++ b/proto-mouse/ftnoir_protocol_mouse.cpp @@ -9,65 +9,83 @@ #include "api/plugin-api.hpp" #include "compat/math.hpp" + #include <cmath> #include <algorithm> + #include <windows.h> #ifndef MOUSEEVENTF_MOVE_NOCOALESCE # define MOUSEEVENTF_MOVE_NOCOALESCE 0x2000 #endif -static const double invert[] = -{ - 1., 1., 1., +static const double invert[] = { + 1., 1., 1., 1., -1., 1. }; -void mouse::pose(const double *headpose) +void mouse::pose(const double* headpose, const double*) { - const int axis_x = s.Mouse_X - 1; - const int axis_y = s.Mouse_Y - 1; + const int axis_x = s.mouse_x - 1; + const int axis_y = s.mouse_y - 1; int mouse_x = 0, mouse_y = 0; - if (axis_x >= 0 && axis_x < 6) - { + if (axis_x == std::clamp(axis_x, (int)Axis_MIN, (int)Axis_MAX)) mouse_x = get_value(headpose[axis_x] * invert[axis_x], - s.sensitivity_x(), + *s.sensitivity_x, axis_x >= 3); - } - if (axis_y >= 0 && axis_y < 6) + if (axis_y == std::clamp(axis_y, (int)Axis_MIN, (int)Axis_MAX)) mouse_y = get_value(headpose[axis_y] * invert[axis_y], - s.sensitivity_y(), + *s.sensitivity_y, axis_y >= 3); - MOUSEINPUT mi; - mi.dx = get_delta(mouse_x, last_x); - mi.dy = get_delta(mouse_y, last_y); - mi.mouseData = 0; - mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE; - mi.time = 0; - mi.dwExtraInfo = 0; - INPUT input; - input.type = INPUT_MOUSE; - input.mi = mi; - (void) SendInput(1, &input, sizeof(INPUT)); - - last_x = mouse_x; - last_y = mouse_y; + int dx = get_delta(mouse_x, last_x), dy = mouse_y - last_y; + + last_x = mouse_x; last_y = mouse_y; + + if (dx || dy) + { + switch (s.input_method) + { + default: + eval_once(qDebug() << "proto/mouse: invalid input method"); + [[fallthrough]]; + case input_direct: + { + INPUT input; + input.type = INPUT_MOUSE; + MOUSEINPUT& mi = input.mi; + mi = {}; + mi.dx = dx; + mi.dy = dy; + mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE; + + (void)SendInput(1, &input, sizeof(input)); + + break; + } + case input_legacy: + { + POINT pt{}; + (void)GetCursorPos(&pt); + (void)SetCursorPos(pt.x + dx, pt.y + dy); + + break; + } + } + } } QString mouse::game_name() { - return otr_tr("Mouse tracker"); + return tr("Mouse tracker"); } int mouse::get_delta(int val, int prev) { - using std::abs; - - const int a = abs(val - prev), b = abs(val + prev); + const int a = std::abs(val - prev), b = std::abs(val + prev); if (b < a) return val + prev; else @@ -76,12 +94,9 @@ int mouse::get_delta(int val, int prev) int mouse::get_value(double val, double sensitivity, bool is_rotation) { - constexpr double sgn[] = { 1e-2, 1 }; - constexpr double c = 1e-1; + constexpr double c[] = { 1e-3, 1e-1 }; - return iround(val * c * sensitivity * sgn[unsigned(is_rotation)]); + return iround(val * sensitivity * c[unsigned(is_rotation)]); } -mouse::mouse() : last_x(0), last_y(0) {} - OPENTRACK_DECLARE_PROTOCOL(mouse, MOUSEControls, mouseDll) diff --git a/proto-mouse/ftnoir_protocol_mouse.h b/proto-mouse/ftnoir_protocol_mouse.h index 55b26fe5..9b52a053 100644 --- a/proto-mouse/ftnoir_protocol_mouse.h +++ b/proto-mouse/ftnoir_protocol_mouse.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015 Stanislaw Halik <sthalik@misaki.pl> +/* Copyright (c) 2015, 2019 Stanislaw Halik <sthalik@misaki.pl> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -10,45 +10,50 @@ #include "ui_ftnoir_mousecontrols.h" #include "mouse-settings.hpp" +#include "api/plugin-api.hpp" #include <QDebug> -#include "api/plugin-api.hpp" + using namespace options; -class mouse : public IProtocol +class mouse : public TR, public IProtocol { -public: - mouse(); - module_status initialize() override { return status_ok(); } - void pose( const double *headpose) override; - QString game_name() override; + Q_OBJECT - int last_x, last_y; -private: static int get_delta(int val, int prev); static int get_value(double val, double sensitivity, bool is_rotation); - struct mouse_settings s; + int last_x = 0, last_y = 0; + mouse_settings s; + +public: + mouse() = default; + module_status initialize() override { return status_ok(); } + void pose(const double* headpose, const double*) override; + QString game_name() override; }; class MOUSEControls: public IProtocolDialog { Q_OBJECT -public: - MOUSEControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} -private: - Ui::UICMOUSEControls ui; + + Ui::UI_mouse ui; mouse_settings s; + private slots: void doOK(); void doCancel(); + +public: + MOUSEControls(); + void register_protocol(IProtocol*) override {} + void unregister_protocol() override {} }; class mouseDll : public Metadata { -public: - QString name() { return otr_tr("mouse emulation"); } - QIcon icon() { return QIcon(":/images/mouse.png"); } + Q_OBJECT + + QString name() override { return tr("mouse emulation"); } + QIcon icon() override { return QIcon(":/images/mouse.png"); } }; diff --git a/proto-mouse/ftnoir_protocol_mouse_dialog.cpp b/proto-mouse/ftnoir_protocol_mouse_dialog.cpp index 77b1ff2e..5646718c 100644 --- a/proto-mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/proto-mouse/ftnoir_protocol_mouse_dialog.cpp @@ -3,19 +3,25 @@ MOUSEControls::MOUSEControls() { - ui.setupUi( this ); + ui.setupUi(this); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &MOUSEControls::doOK); + connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &MOUSEControls::doCancel); - tie_setting(s.Mouse_X, ui.cbxSelectMouse_X); - tie_setting(s.Mouse_Y, ui.cbxSelectMouse_Y); + tie_setting(s.mouse_x, ui.axis_x); + tie_setting(s.mouse_y, ui.axis_y); tie_setting(s.sensitivity_x, ui.sensitivity_x); tie_setting(s.sensitivity_y, ui.sensitivity_y); + + const int data[] = { input_direct, input_legacy }; + for (unsigned k = 0; k < std::size(data); k++) + ui.input_method->setItemData(k, data[k]); + tie_setting(s.input_method, ui.input_method); } -void MOUSEControls::doOK() { +void MOUSEControls::doOK() +{ s.b->save(); close(); } @@ -24,4 +30,3 @@ void MOUSEControls::doCancel() { close(); } - diff --git a/proto-mouse/lang/nl_NL.ts b/proto-mouse/lang/nl_NL.ts index 68fa7065..13a75520 100644 --- a/proto-mouse/lang/nl_NL.ts +++ b/proto-mouse/lang/nl_NL.ts @@ -2,21 +2,13 @@ <!DOCTYPE TS> <TS version="2.1" language="nl_NL"> <context> - <name>UICMOUSEControls</name> + <name>UI_mouse</name> <message> - <source>Mouse protocol settings</source> + <source>Mouse protocol</source> <translation type="unfinished"></translation> </message> <message> - <source>Map mouse X to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Map mouse Y to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Select Number</source> + <source>X axis</source> <translation type="unfinished"></translation> </message> <message> @@ -48,11 +40,37 @@ <translation type="unfinished"></translation> </message> <message> - <source>X axis sensitivity</source> + <source>Y axis</source> <translation type="unfinished"></translation> </message> <message> - <source>Y axis sensitivity</source> + <source>Sensitivity</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Method</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Direct input</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Legacy</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouse</name> + <message> + <source>Mouse tracker</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouseDll</name> + <message> + <source>mouse emulation</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-mouse/lang/ru_RU.ts b/proto-mouse/lang/ru_RU.ts index 39f27c12..bdadb6bd 100644 --- a/proto-mouse/lang/ru_RU.ts +++ b/proto-mouse/lang/ru_RU.ts @@ -2,21 +2,13 @@ <!DOCTYPE TS> <TS version="2.1" language="ru_RU"> <context> - <name>UICMOUSEControls</name> + <name>UI_mouse</name> <message> - <source>Mouse protocol settings</source> + <source>Mouse protocol</source> <translation type="unfinished"></translation> </message> <message> - <source>Map mouse X to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Map mouse Y to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Select Number</source> + <source>X axis</source> <translation type="unfinished"></translation> </message> <message> @@ -48,11 +40,37 @@ <translation type="unfinished"></translation> </message> <message> - <source>X axis sensitivity</source> + <source>Y axis</source> <translation type="unfinished"></translation> </message> <message> - <source>Y axis sensitivity</source> + <source>Sensitivity</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Method</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Direct input</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Legacy</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouse</name> + <message> + <source>Mouse tracker</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouseDll</name> + <message> + <source>mouse emulation</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-mouse/lang/stub.ts b/proto-mouse/lang/stub.ts index 3449ab53..2a811df1 100644 --- a/proto-mouse/lang/stub.ts +++ b/proto-mouse/lang/stub.ts @@ -2,21 +2,13 @@ <!DOCTYPE TS> <TS version="2.1"> <context> - <name>UICMOUSEControls</name> + <name>UI_mouse</name> <message> - <source>Mouse protocol settings</source> + <source>Mouse protocol</source> <translation type="unfinished"></translation> </message> <message> - <source>Map mouse X to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Map mouse Y to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Select Number</source> + <source>X axis</source> <translation type="unfinished"></translation> </message> <message> @@ -48,11 +40,37 @@ <translation type="unfinished"></translation> </message> <message> - <source>X axis sensitivity</source> + <source>Y axis</source> <translation type="unfinished"></translation> </message> <message> - <source>Y axis sensitivity</source> + <source>Sensitivity</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Method</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Direct input</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Legacy</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouse</name> + <message> + <source>Mouse tracker</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouseDll</name> + <message> + <source>mouse emulation</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-mouse/lang/zh_CN.ts b/proto-mouse/lang/zh_CN.ts index 3449ab53..e69c4bfe 100644 --- a/proto-mouse/lang/zh_CN.ts +++ b/proto-mouse/lang/zh_CN.ts @@ -1,58 +1,76 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> <context> - <name>UICMOUSEControls</name> + <name>UI_mouse</name> <message> - <source>Mouse protocol settings</source> + <source>Mouse protocol</source> <translation type="unfinished"></translation> </message> <message> - <source>Map mouse X to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Map mouse Y to:</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Select Number</source> - <translation type="unfinished"></translation> + <source>X axis</source> + <translation>X 轴</translation> </message> <message> <source>None</source> - <translation type="unfinished"></translation> + <translation>无</translation> </message> <message> <source>X</source> - <translation type="unfinished"></translation> + <translation></translation> </message> <message> <source>Y</source> - <translation type="unfinished"></translation> + <translation></translation> </message> <message> <source>Z</source> - <translation type="unfinished"></translation> + <translation></translation> </message> <message> <source>Yaw</source> - <translation type="unfinished"></translation> + <translation>航向</translation> </message> <message> <source>Pitch</source> - <translation type="unfinished"></translation> + <translation>俯仰</translation> </message> <message> <source>Roll</source> + <translation>滚转</translation> + </message> + <message> + <source>Y axis</source> + <translation>Y 轴</translation> + </message> + <message> + <source>Sensitivity</source> + <translation>灵敏度</translation> + </message> + <message> + <source>Method</source> + <translation>方式</translation> + </message> + <message> + <source>Direct input</source> <translation type="unfinished"></translation> </message> <message> - <source>X axis sensitivity</source> + <source>Legacy</source> <translation type="unfinished"></translation> </message> +</context> +<context> + <name>mouse</name> + <message> + <source>Mouse tracker</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>mouseDll</name> <message> - <source>Y axis sensitivity</source> + <source>mouse emulation</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-mouse/mouse-settings.hpp b/proto-mouse/mouse-settings.hpp index c29024ac..fda06166 100644 --- a/proto-mouse/mouse-settings.hpp +++ b/proto-mouse/mouse-settings.hpp @@ -2,22 +2,24 @@ #include "options/options.hpp" +enum input_method { + input_direct = 0, input_legacy = 1, +}; + namespace mouse_impl { using namespace options; -struct mouse_settings : opts { - value<int> Mouse_X, Mouse_Y; - value<slider_value> sensitivity_x, sensitivity_y; - mouse_settings() : - opts("mouse-proto"), - Mouse_X(b, "mouse-x", 0), - Mouse_Y(b, "mouse-y", 0), - sensitivity_x(b, "mouse-sensitivity-x", slider_value(200, 25, 500)), - sensitivity_y(b, "mouse-sensitivity-y", slider_value(200, 25, 500)) - {} +struct mouse_settings : opts +{ + value<int> mouse_x { b, "mouse-x", 0 }, mouse_y { b, "mouse-y", 0 }; + value<slider_value> sensitivity_x { b, "mouse-sensitivity-x", { 200, 25, 500 } }; + value<slider_value> sensitivity_y { b, "mouse-sensitivity-y", { 200, 25, 500 } }; + value<input_method> input_method { b, "input-method", input_direct }; + + mouse_settings() : opts("mouse-proto") {} }; } // ns mouse_impl -using mouse_impl::mouse_settings; +using mouse_settings = mouse_impl::mouse_settings; |