diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-10 14:29:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-10 14:29:17 +0300 |
commit | 69eed0d99caea86486206f8d45705827f7a6fe19 (patch) | |
tree | 426c59b2e6cbf7724ad4a44d00df6c59fa1e0471 /src/gui/sdlinput.cpp | |
parent | ad5bfca7d5df9201e5460e68ca149674bac5ac2c (diff) | |
download | manaverse-69eed0d99caea86486206f8d45705827f7a6fe19.tar.gz manaverse-69eed0d99caea86486206f8d45705827f7a6fe19.tar.bz2 manaverse-69eed0d99caea86486206f8d45705827f7a6fe19.tar.xz manaverse-69eed0d99caea86486206f8d45705827f7a6fe19.zip |
Add mouse move simulation. After char id to name mapping received, simulate mouse move.
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); +} |