aiaf Posted February 23, 2017 Share Posted February 23, 2017 Hi, Im getting the mouse wheel index(in the main loop) and use this in a menu: selectedDirection = (int)window->GetMousePosition().z; There is a function, or other way, that detects that Wheel moved ? Something like: if(window->MouseWheelHit()) { do something } Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Jazz Posted February 23, 2017 Share Posted February 23, 2017 http://www.leadwerks.com/werkspace/topic/12448-a-more-robust-input-command/#entry89840 edit: Noticed you need it for C++ so this won't help much Quote --- Scott Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060 Link to comment Share on other sites More sharing options...
Roland Posted February 23, 2017 Share Posted February 23, 2017 You have to check the mouse position Z component class SomeClass { float _lastMZ; ... void Init() { _lastMZ = Window::GetCurrent()->GetMousePosition().z; } void UpdateWorld() { auto mz = Window::GetCurrent()->GetMousePosition().z; if ( mz != _lastMZ ) { // mouse wheel moved // distance is mz-_lastMZ _lastMZ = mz; } } }; 1 1 Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
aiaf Posted February 23, 2017 Author Share Posted February 23, 2017 Thanks seems im tired and lazy, i wanted a window->MouseWheelHit() event Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Roland Posted February 23, 2017 Share Posted February 23, 2017 class MouseSensorListener { public: virtual void onmousewheelHit( float distance ) = 0; }; class MouseSensor { private: float _lastMZ; MouseSensorListener _listener; public: void init() { _listener = nullptr; _lastMZ = Window::GetCurrent()->GetMousePosition().z; } void register( MouseSensorListener* listener ) { _listener = listener; } void unregister() { _listener = nullptr; } void update() { auto mz = Window::GetCurrent()->GetMousePosition().z; if ( mz != _lastMZ ) { // mouse wheel moved // distance is mz-_lastMZ if( _listener ) { _listener->onmousewheelHit(mz-_lastMZ); } _lastMZ = mz; } } }; class SomeClass : public MouseSensorListener { public: void init( MouseSensor* sensor ) { sensor->register(this); } void onmousewheelHit( float distance ) { // Mouse wheel moved 'distance' } }; Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.