|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|