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

preparation

This commit is contained in:
Michael
2023-08-26 19:53:36 +02:00
committed by GitHub
parent 3b06abd0d7
commit bd0f9bb280
6 changed files with 36 additions and 4 deletions

View File

@ -25,6 +25,7 @@
#include "../render/Canvas.h"
#include "../render/IImage.h"
#include "../renderSDL/SDL_Extensions.h"
#include "../eventsSDL/InputHandler.h"
#include "../../CCallback.h"
@ -82,6 +83,13 @@ void BasicMapView::showAll(Canvas & to)
render(to, true);
}
void MapView::tick(uint32_t msPassed)
{
postSwipe(msPassed);
controller->tick(msPassed);
}
void MapView::show(Canvas & to)
{
actions->setContext(controller->getContext());
@ -115,9 +123,16 @@ void MapView::onMapScrolled(const Point & distance)
void MapView::onMapSwiped(const Point & viewPosition)
{
swipeHistory[GH.input().getTicks()] = viewPosition;
controller->setViewCenter(model->getMapViewCenter() + viewPosition, model->getLevel());
}
void MapView::postSwipe(uint32_t msPassed) {
if(!actions->dragActive)
swipeHistory.clear();
}
void MapView::onCenteredTile(const int3 & tile)
{
controller->setViewCenter(tile);