Draw minimap background without map

master
Henrique Santiago 11 years ago
parent adc01ab9e3
commit ffcb65f365

@ -95,8 +95,8 @@ void Minimap::clean()
void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scale)
{
if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition())
return ;
if(screenRect.isEmpty())
return;
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
g_painter->saveState();
@ -105,6 +105,11 @@ void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scal
g_painter->resetColor();
g_painter->setClipRect(screenRect);
if(MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition()) {
g_painter->restoreSavedState();
return;
}
Point blockOff = getBlockOffset(mapRect.topLeft());
Point off = Point((mapRect.size() * scale).toPoint() - screenRect.size().toPoint())/2;
Point start = screenRect.topLeft() -(mapRect.topLeft() - blockOff)*scale - off;

@ -182,4 +182,3 @@ void UIWidget::setImageSource(const std::string& source)
m_imageTexture = g_textures.getTexture(source);
m_imageMustRecache = true;
}

Loading…
Cancel
Save