summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-01 23:18:52 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-02 23:50:33 +0300
commit1cafda1147c06a647e3d3f1e3f986d7296ccbd08 (patch)
tree920e60dbd1feb3657edc130aa6a4ba4af562454a /src/gui/gui.cpp
parentb210f1b896039b4909ca5fb7abea8b437896a77a (diff)
downloadmv-1cafda1147c06a647e3d3f1e3f986d7296ccbd08.tar.gz
mv-1cafda1147c06a647e3d3f1e3f986d7296ccbd08.tar.bz2
mv-1cafda1147c06a647e3d3f1e3f986d7296ccbd08.tar.xz
mv-1cafda1147c06a647e3d3f1e3f986d7296ccbd08.zip
add support for drag and drop in spells window.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index d751c6ec0..debbe342f 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -438,9 +438,19 @@ void Gui::draw()
const Image *const image = dragDrop.getItemImage();
if (image)
{
- const int tPosX = mouseX - (image->mBounds.w / 2);
- const int tPosY = mouseY - (image->mBounds.h / 2);
- g2->drawImage(image, tPosX, tPosY);
+ const int posX = mouseX - (image->mBounds.w / 2);
+ const int posY = mouseY - (image->mBounds.h / 2);
+ g2->drawImage(image, posX, posY);
+ }
+ if (mGuiFont)
+ {
+ const std::string &str = dragDrop.getText();
+ if (!str.empty())
+ {
+ const int posX = mouseX - mGuiFont->getWidth(str) / 2;
+ const int posY = mouseY + (image ? image->mBounds.h / 2 : 0);
+ mGuiFont->drawString(g2, str, posX, posY);
+ }
}
Image *const mouseCursor = mMouseCursors->get(mCursorType);