1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Separated timer updates from rendering in adventure map and town screen

This commit is contained in:
Ivan Savenko
2023-05-13 17:24:18 +03:00
parent 3ecdff2a21
commit fa496628f2
8 changed files with 27 additions and 13 deletions

View File

@ -55,6 +55,8 @@ BasicMapView::BasicMapView(const Point & offset, const Point & dimensions)
pos += offset;
pos.w = dimensions.x;
pos.h = dimensions.y;
addUsedEvents(TIME);
}
void BasicMapView::render(Canvas & target, bool fullUpdate)
@ -64,21 +66,22 @@ void BasicMapView::render(Canvas & target, bool fullUpdate)
tilesCache->render(controller->getContext(), targetClipped, fullUpdate);
}
void BasicMapView::tick(uint32_t msPassed)
{
controller->tick(msPassed);
}
void BasicMapView::show(SDL_Surface * to)
{
controller->updateBefore(GH.getFrameDeltaMilliseconds());
Canvas target(to);
CSDL_Ext::CClipRectGuard guard(to, pos);
render(target, false);
controller->updateAfter(GH.getFrameDeltaMilliseconds());
controller->afterRender();
}
void BasicMapView::showAll(SDL_Surface * to)
{
controller->updateBefore(0);
Canvas target(to);
CSDL_Ext::CClipRectGuard guard(to, pos);
render(target, true);