diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-01-16 19:14:19 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-01-16 19:14:19 +0100 |
commit | ce65b5437b26004ad69763443dd167154042c97a (patch) | |
tree | 9964af0409f14b416b867b431d5d4707c93e7f84 /proto-mouse/ftnoir_protocol_mouse.h | |
parent | ce217c33d2f588fa239a97a772296046888f0b80 (diff) |
proto/mouse: don't depend on float difference
It underflowed cause of our high dt.
Also get the smallest difference over the screen, for HMD devices.
Allow for very low-sensitivity operation.
Issue: #523
Diffstat (limited to 'proto-mouse/ftnoir_protocol_mouse.h')
-rw-r--r-- | proto-mouse/ftnoir_protocol_mouse.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/proto-mouse/ftnoir_protocol_mouse.h b/proto-mouse/ftnoir_protocol_mouse.h index e920c047..4f0bf5a7 100644 --- a/proto-mouse/ftnoir_protocol_mouse.h +++ b/proto-mouse/ftnoir_protocol_mouse.h @@ -20,24 +20,23 @@ struct settings : opts { opts("mouse-proto"), Mouse_X(b, "mouse-x", 0), Mouse_Y(b, "mouse-y", 0), - sensitivity_x(b, "mouse-sensitivity-x", slider_value(200, 100, 500)), - sensitivity_y(b, "mouse-sensitivity-y", slider_value(200, 100, 500)) + sensitivity_x(b, "mouse-sensitivity-x", slider_value(200, 25, 500)), + sensitivity_y(b, "mouse-sensitivity-y", slider_value(200, 25, 500)) {} }; class mouse : public IProtocol { public: - mouse() : last_pos_x(0), last_pos_y(0), last_x(0), last_y(0) {} + mouse(); bool correct() override; void pose( const double *headpose) override; QString game_name() override; - double last_pos_x, last_pos_y; int last_x, last_y; private: - static double get_rotation(double val, double last_val); - static int get_value(double val, double& last_pos, int& last_px, bool is_rotation, double sensitivity); + static int get_delta(int val, int prev); + static int get_value(double val, double sensitivity, bool is_rotation); struct settings s; }; |