Draw minimap background without map

This commit is contained in:
Henrique Santiago 2013-02-13 18:40:15 -02:00
parent adc01ab9e3
commit ffcb65f365
2 changed files with 7 additions and 3 deletions

View File

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

View File

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