From 5ab72bf802e7a79d6eacded4e985740324c4faa7 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 15 Mar 2022 09:54:34 -0400 Subject: started adding zooming anim, looks weird esp when moving --- src/game.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index beabc55..fc57acc 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -523,8 +523,10 @@ void Game::setZoom(size_t zoom) return; } - zoomProgress = 0; - zoomLength = std::abs(static_cast(zoom - curZoom)) * TILE_WIDTH; + /*zoomProgress = 0; + zoomLength = std::abs(static_cast(zoom - curZoom)) * TILE_WIDTH;*/ + zoomProgress.start(62 * std::abs(static_cast(zoom - curZoom)) * TILE_WIDTH); + oldZoom = curZoom; curZoom = zoom; zooming = true; loadMap(); @@ -824,7 +826,7 @@ void Game::update(size_t frameTime) { recalculateRender(); } - zoomTimer.accumulate(frameTime); + /*zoomTimer.accumulate(frameTime); while (zoomTimer.step()) { if (zooming) @@ -836,6 +838,12 @@ void Game::update(size_t frameTime) { zooming = false; } } + }*/ + if (zooming) { + zoomProgress.tick(frameTime); + if (zoomProgress.isComplete()) { + zooming = false; + } } playerAnim.update(frameTime); -- cgit 1.4.1