summaryrefslogtreecommitdiff
path: root/src/gui/sdlinput.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-10 14:29:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-10 14:29:17 +0300
commit69eed0d99caea86486206f8d45705827f7a6fe19 (patch)
tree426c59b2e6cbf7724ad4a44d00df6c59fa1e0471 /src/gui/sdlinput.cpp
parentad5bfca7d5df9201e5460e68ca149674bac5ac2c (diff)
downloadmanaplus-69eed0d99caea86486206f8d45705827f7a6fe19.tar.gz
manaplus-69eed0d99caea86486206f8d45705827f7a6fe19.tar.bz2
manaplus-69eed0d99caea86486206f8d45705827f7a6fe19.tar.xz
manaplus-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.cpp21
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);
+}