diff options
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r-- | src/gui/sdlinput.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 689066fb5..f3dcc47b2 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -79,6 +79,7 @@ #include "input/inputmanager.h" +#include "gui/gui.h" #include "gui/sdlinput.h" #include "render/graphics.h" @@ -92,6 +93,8 @@ #include "debug.h" +SDLInput *guiInput = nullptr; + SDLInput::SDLInput() : mKeyInputQueue(), mMouseInputQueue(), @@ -546,3 +549,21 @@ void SDLInput::simulateMouseClick(const int x, const int y, mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); } + +void SDLInput::simulateMouseMove() +{ + if (!gui) + return; + + int x, y; + Gui::getMouseState(x, y); + + MouseInput mouseInput; + mouseInput.setX(x); + mouseInput.setY(y); + mouseInput.setReal(x, y); + mouseInput.setButton(MouseButton::EMPTY); + mouseInput.setType(MouseEventType::MOVED); + mouseInput.setTimeStamp(SDL_GetTicks()); + mMouseInputQueue.push(mouseInput); +} |