mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-08 13:46:39 +00:00
This resolves two issues: 1) Ensure that cursor tooltips stay displayed when buying spells or selling or consuming items and any other place where actions can highlight new items. 2) Ignore small mouse movements if we've just warped the mouse pointer a long distance. This resolves an issue where slight cursor wiggle will trigger after changing the dpad highlight.
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
#ifndef MWINPUT_MWMOUSEMANAGER_H
|
|
#define MWINPUT_MWMOUSEMANAGER_H
|
|
|
|
#include <components/sdlutil/events.hpp>
|
|
#include <components/settings/settings.hpp>
|
|
|
|
namespace SDLUtil
|
|
{
|
|
class InputWrapper;
|
|
}
|
|
|
|
namespace MWInput
|
|
{
|
|
class BindingsManager;
|
|
|
|
class MouseManager : public SDLUtil::MouseListener
|
|
{
|
|
public:
|
|
MouseManager(BindingsManager* bindingsManager, SDLUtil::InputWrapper* inputWrapper, SDL_Window* window);
|
|
|
|
virtual ~MouseManager() = default;
|
|
|
|
void updateCursorMode();
|
|
void update(float dt);
|
|
|
|
void mouseMoved(const SDLUtil::MouseMotionEvent& arg) override;
|
|
void mousePressed(const SDL_MouseButtonEvent& arg, Uint8 id) override;
|
|
void mouseReleased(const SDL_MouseButtonEvent& arg, Uint8 id) override;
|
|
void mouseWheelMoved(const SDL_MouseWheelEvent& arg) override;
|
|
|
|
bool injectMouseButtonPress(Uint8 button);
|
|
bool injectMouseButtonRelease(Uint8 button);
|
|
void injectMouseMove(float xMove, float yMove, float mouseWheelMove);
|
|
void warpMouse();
|
|
void warpMouseToWidget(MyGUI::Widget* widget);
|
|
|
|
void setMouseLookEnabled(bool enabled) { mMouseLookEnabled = enabled; }
|
|
void setGuiCursorEnabled(bool enabled) { mGuiCursorEnabled = enabled; }
|
|
|
|
int getMouseMoveX() const { return mMouseMoveX; }
|
|
int getMouseMoveY() const { return mMouseMoveY; }
|
|
|
|
private:
|
|
BindingsManager* mBindingsManager;
|
|
SDLUtil::InputWrapper* mInputWrapper;
|
|
|
|
float mGuiCursorX;
|
|
float mGuiCursorY;
|
|
int mMouseWheel;
|
|
bool mMouseLookEnabled;
|
|
bool mGuiCursorEnabled;
|
|
float mLastWarpX;
|
|
float mLastWarpY;
|
|
|
|
int mMouseMoveX;
|
|
int mMouseMoveY;
|
|
};
|
|
}
|
|
#endif
|