mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
Redering order was fixed
This commit is contained in:
parent
a63c00a90e
commit
ec2204715a
@ -105,7 +105,6 @@ MapScene::MapScene(MainWindow *parent, int l):
|
|||||||
main(parent),
|
main(parent),
|
||||||
level(l)
|
level(l)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapScene::updateViews()
|
void MapScene::updateViews()
|
||||||
@ -114,6 +113,9 @@ void MapScene::updateViews()
|
|||||||
gridView.update();
|
gridView.update();
|
||||||
passabilityView.update();
|
passabilityView.update();
|
||||||
selectionTerrainView.update();
|
selectionTerrainView.update();
|
||||||
|
|
||||||
|
terrainView.show(true);
|
||||||
|
selectionTerrainView.show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicView::BasicView(MainWindow * m, MapScene * s): main(m), scene(s)
|
BasicView::BasicView(MainWindow * m, MapScene * s): main(m), scene(s)
|
||||||
@ -129,14 +131,24 @@ void BasicView::show(bool show)
|
|||||||
|
|
||||||
if(show)
|
if(show)
|
||||||
{
|
{
|
||||||
if(item)
|
if(pixmap)
|
||||||
scene->addItem(item.get());
|
{
|
||||||
|
if(item)
|
||||||
|
item->setPixmap(*pixmap);
|
||||||
|
else
|
||||||
|
item.reset(scene->addPixmap(*pixmap));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
item.reset(scene->addPixmap(*pixmap));
|
{
|
||||||
|
if(item)
|
||||||
|
item->setPixmap(emptyPixmap);
|
||||||
|
else
|
||||||
|
item.reset(scene->addPixmap(emptyPixmap));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scene->removeItem(item.get());
|
item->setPixmap(emptyPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
isShown = show;
|
isShown = show;
|
||||||
@ -145,11 +157,18 @@ void BasicView::show(bool show)
|
|||||||
void BasicView::redraw()
|
void BasicView::redraw()
|
||||||
{
|
{
|
||||||
if(item)
|
if(item)
|
||||||
scene->removeItem(item.get());
|
|
||||||
|
|
||||||
if(isShown)
|
|
||||||
{
|
{
|
||||||
item.reset(scene->addPixmap(*pixmap));
|
if(pixmap && isShown)
|
||||||
|
item->setPixmap(*pixmap);
|
||||||
|
else
|
||||||
|
item->setPixmap(emptyPixmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(pixmap && isShown)
|
||||||
|
item.reset(scene->addPixmap(*pixmap));
|
||||||
|
else
|
||||||
|
item.reset(scene->addPixmap(emptyPixmap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,8 +182,6 @@ void GridView::update()
|
|||||||
if(!map)
|
if(!map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
show(false);
|
|
||||||
|
|
||||||
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
||||||
pixmap->fill(QColor(0, 0, 0, 0));
|
pixmap->fill(QColor(0, 0, 0, 0));
|
||||||
QPainter painter(pixmap.get());
|
QPainter painter(pixmap.get());
|
||||||
@ -179,7 +196,7 @@ void GridView::update()
|
|||||||
painter.drawLine(i * 32, 0, i * 32, map->height * 32 - 1);
|
painter.drawLine(i * 32, 0, i * 32, map->height * 32 - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
show(isShown);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
PassabilityView::PassabilityView(MainWindow * m, MapScene * s): BasicView(m, s)
|
PassabilityView::PassabilityView(MainWindow * m, MapScene * s): BasicView(m, s)
|
||||||
@ -192,8 +209,6 @@ void PassabilityView::update()
|
|||||||
if(!map)
|
if(!map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
show(false);
|
|
||||||
|
|
||||||
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
||||||
pixmap->fill(QColor(0, 0, 0, 0));
|
pixmap->fill(QColor(0, 0, 0, 0));
|
||||||
|
|
||||||
@ -213,7 +228,7 @@ void PassabilityView::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
show(isShown);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionTerrainView::SelectionTerrainView(MainWindow * m, MapScene * s): BasicView(m, s)
|
SelectionTerrainView::SelectionTerrainView(MainWindow * m, MapScene * s): BasicView(m, s)
|
||||||
@ -226,8 +241,6 @@ void SelectionTerrainView::update()
|
|||||||
if(!map)
|
if(!map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
show(false);
|
|
||||||
|
|
||||||
area.clear();
|
area.clear();
|
||||||
areaAdd.clear();
|
areaAdd.clear();
|
||||||
areaErase.clear();
|
areaErase.clear();
|
||||||
@ -235,7 +248,7 @@ void SelectionTerrainView::update()
|
|||||||
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
||||||
pixmap->fill(QColor(0, 0, 0, 0));
|
pixmap->fill(QColor(0, 0, 0, 0));
|
||||||
|
|
||||||
show(true); //always visible
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTerrainView::draw()
|
void SelectionTerrainView::draw()
|
||||||
@ -302,12 +315,8 @@ void TerrainView::update()
|
|||||||
if(!map)
|
if(!map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
show(false);
|
|
||||||
|
|
||||||
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
pixmap.reset(new QPixmap(map->width * 32, map->height * 32));
|
||||||
draw(false);
|
draw(false);
|
||||||
|
|
||||||
show(true); //always visible
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainView::setDirty(const int3 & tile)
|
void TerrainView::setDirty(const int3 & tile)
|
||||||
|
@ -25,6 +25,7 @@ protected:
|
|||||||
bool isShown = false;
|
bool isShown = false;
|
||||||
|
|
||||||
std::unique_ptr<QPixmap> pixmap;
|
std::unique_ptr<QPixmap> pixmap;
|
||||||
|
QPixmap emptyPixmap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<QGraphicsPixmapItem> item;
|
std::unique_ptr<QGraphicsPixmapItem> item;
|
||||||
|
@ -21,6 +21,13 @@ WindowNewMap::WindowNewMap(QWidget *parent) :
|
|||||||
setWindowModality(Qt::ApplicationModal);
|
setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
|
//setup initial parameters
|
||||||
|
mapGenOptions.setWidth(ui->widthTxt->text().toInt());
|
||||||
|
mapGenOptions.setHeight(ui->heightTxt->text().toInt());
|
||||||
|
bool twoLevel = ui->twoLevelCheck->isChecked();
|
||||||
|
mapGenOptions.setHasTwoLevels(twoLevel);
|
||||||
|
updateTemplateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowNewMap::~WindowNewMap()
|
WindowNewMap::~WindowNewMap()
|
||||||
|
Loading…
Reference in New Issue
Block a user