From 1cafda1147c06a647e3d3f1e3f986d7296ccbd08 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Jul 2013 23:18:52 +0300 Subject: add support for drag and drop in spells window. --- src/gui/gui.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/gui/gui.cpp') 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); -- cgit v1.2.3-60-g2f50