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

Framerate manager is now in a separate file and private member of GH

This commit is contained in:
Ivan Savenko
2023-05-13 00:15:48 +03:00
parent 0a874cd89e
commit 03df274450
18 changed files with 156 additions and 111 deletions

View File

@ -59,7 +59,7 @@ AdventureMapInterface::AdventureMapInterface():
shortcuts->setState(EAdventureState::MAKING_TURN);
widget->getMapView()->onViewMapActivated();
addUsedEvents(KEYBOARD);
addUsedEvents(KEYBOARD | TIME);
}
void AdventureMapInterface::onMapViewMoved(const Rect & visibleArea, int mapLevel)
@ -139,18 +139,20 @@ void AdventureMapInterface::showAll(SDL_Surface * to)
void AdventureMapInterface::show(SDL_Surface * to)
{
handleMapScrollingUpdate();
CIntObject::show(to);
LOCPLINT->cingconsole->show(to);
}
void AdventureMapInterface::handleMapScrollingUpdate()
void AdventureMapInterface::tick(uint32_t msPassed)
{
handleMapScrollingUpdate(msPassed);
}
void AdventureMapInterface::handleMapScrollingUpdate(uint32_t timePassed)
{
/// Width of window border, in pixels, that triggers map scrolling
static constexpr uint32_t borderScrollWidth = 15;
uint32_t timePassed = GH.mainFPSmng->getElapsedMilliseconds();
uint32_t scrollSpeedPixels = settings["adventure"]["scrollSpeedPixels"].Float();
uint32_t scrollDistance = scrollSpeedPixels * timePassed / 1000;