summaryrefslogtreecommitdiff
path: root/src/gui
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
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')
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/gui.h1
-rw-r--r--src/gui/popups/itempopup.cpp1
-rw-r--r--src/gui/sdlinput.cpp21
-rw-r--r--src/gui/sdlinput.h4
5 files changed, 26 insertions, 5 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 330f2c54b..ea527e3ef 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -100,11 +100,7 @@
#include "debug.h"
-// Guichan stuff
Gui *gui = nullptr;
-SDLInput *guiInput = nullptr;
-
-// Bolded font
Font *boldFont = nullptr;
Gui::Gui() :
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 420e79734..1d1b80667 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -535,7 +535,6 @@ class Gui final
};
extern Gui *gui; /**< The GUI system */
-extern SDLInput *guiInput; /**< GUI input */
/**
* Bolded text font
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 56e907620..e70de0a5c 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -281,6 +281,7 @@ std::string ItemPopup::getCardsString(const int *const cards)
{
name = toString(charId);
beingHandler->requestNameByCharId(charId);
+ mLastId = 0; // allow recreate popup with same data
}
// TRANSLATORS: named item description
label.append(strprintf(_("Item named: %s"), name.c_str()));
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);
+}
diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h
index fb1c2e924..4e46b7356 100644
--- a/src/gui/sdlinput.h
+++ b/src/gui/sdlinput.h
@@ -120,6 +120,8 @@ class SDLInput final
void simulateMouseClick(const int x, const int y,
const MouseButtonT button);
+ void simulateMouseMove();
+
protected:
/**
* Converts a mouse button from SDL to a Guichan mouse button
@@ -149,4 +151,6 @@ class SDLInput final
bool mMouseInWindow;
};
+extern SDLInput *guiInput; /**< GUI input */
+
#endif // GUI_SDLINPUT_H