From 353aa5215e1694d43be88269126c1fdc05696e26 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Mon, 9 Apr 2012 16:33:40 -0300 Subject: [PATCH] fix drawing of 2x2 items on UIItem --- src/otclient/ui/uiitem.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/otclient/ui/uiitem.cpp b/src/otclient/ui/uiitem.cpp index 8512b0a5..6fa6d5fd 100644 --- a/src/otclient/ui/uiitem.cpp +++ b/src/otclient/ui/uiitem.cpp @@ -36,16 +36,20 @@ void UIItem::drawSelf() if(m_item) { Rect drawRect = getClippingRect(); - float scaleFactor = std::min(drawRect.width() / 32.0f, drawRect.height() / 32.0f); + Point dest = drawRect.topLeft(); + float scaleFactor = std::min(drawRect.width() / (float)m_item->getExactSize(), drawRect.height() / (float)m_item->getExactSize()); + dest += (1 - scaleFactor)*32; + dest += m_item->getDisplacement() * scaleFactor; g_painter.setColor(Color::white); - m_item->draw(drawRect.topLeft(), scaleFactor, true); + m_item->draw(dest, scaleFactor, true); if(m_font && m_item->isStackable() && m_item->getCount() > 1) { std::string count = Fw::tostring(m_item->getCount()); g_painter.setColor(Color(231, 231, 231)); m_font->drawText(count, Rect(m_rect.topLeft(), m_rect.bottomRight() - Point(3, 0)), Fw::AlignBottomRight); } + //m_font->drawText(Fw::tostring(m_item->getId()), m_rect, Fw::AlignBottomRight); } }