Draw minimap background without map
This commit is contained in:
parent
adc01ab9e3
commit
ffcb65f365
|
@ -95,7 +95,7 @@ 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);
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue