1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Basic version of scaling for view world

This commit is contained in:
Ivan Savenko
2023-02-20 16:31:14 +02:00
parent 16e7f860ff
commit 40413ee6be
6 changed files with 34 additions and 25 deletions

View File

@ -33,6 +33,7 @@ MapViewCache::~MapViewCache() = default;
MapViewCache::MapViewCache(const std::shared_ptr<MapViewModel> & model)
: model(model)
, mapRenderer(new MapRenderer())
, intermediate(new Canvas(Point(32,32)))
, terrain(new Canvas(model->getCacheDimensionsPixels()))
{
}
@ -46,7 +47,15 @@ void MapViewCache::updateTile(const std::shared_ptr<MapRendererContext> & contex
{
Canvas target = getTile(coordinates);
mapRenderer->renderTile(*context, target, coordinates);
if(model->getSingleTileSize() == Point(32, 32))
{
mapRenderer->renderTile(*context, target, coordinates);
}
else
{
mapRenderer->renderTile(*context, *intermediate, coordinates);
target.drawScaled(*intermediate, Point(0, 0), model->getSingleTileSize());
}
}
void MapViewCache::update(const std::shared_ptr<MapRendererContext> & context)
@ -541,7 +550,7 @@ void MapViewController::update(uint32_t timeDelta)
}
context->animationTime += timeDelta;
context->tileSize = model->getSingleTileSize();
context->tileSize = Point(32,32); //model->getSingleTileSize();
}
void MapViewController::onObjectFadeIn(const CGObjectInstance * obj)