MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSpaceMouseHandlerWindows.h
Go to the documentation of this file.
1#pragma once
2#ifdef _WIN32
5
6#include <thread>
7
8namespace MR
9{
10
11class SpaceMouseHandlerWindows : public SpaceMouseHandler, public MultiListener<PostFocusListener>
12{
13public:
14 SpaceMouseHandlerWindows();
15 ~SpaceMouseHandlerWindows() override;
16
17 bool initialize() override;
18 void handle() override;
19 void updateConnected( int jid, int event ) override;
20
21 // set state of zoom by mouse scroll (to fix scroll signal from spacemouse driver)
22 MRVIEWER_API void activateMouseScrollZoom( bool activeMouseScrollZoom );
23 // get state of zoom by mouse scroll
24 bool isMouseScrollZoomActive() { return activeMouseScrollZoom_; }
25private:
26 bool active_{ true };
27 bool initialized_{ false };
28 std::array<unsigned char, SMB_BUTTON_COUNT> buttons_{};
29 int joystickIndex_{ -1 };
30 const int* mapButtons_{ nullptr };
31 int buttonsCount_{ 0 };
32 float handleTime_{ 0.f };
33
34 std::thread updateThread_;
35 std::atomic_bool updateThreadActive_{ true };
36 std::atomic<std::array<float, 6>> axesDiff_;
37 std::array<float, 6> axesOld_{};
38
39 bool activeMouseScrollZoom_{ false };
40
41 //hotfix TODO rework
42 bool isUniversalReceiver_{ false };
43
44 virtual void postFocus_( bool focused ) override;
45
46 void updateConnected_();
47 void startUpdateThread_();
48};
49
50}
51
52#endif