diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-19 10:09:14 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-19 10:09:14 -0400 |
commit | 6cfe247b362106543bbb1a835dde9e7da9128fee (patch) | |
tree | 76a24a4b241df6f6dea9ae6774c80d944062775f /src | |
parent | 0a39ccd0b0c5b855fa7b5dea2082ced774923a62 (diff) | |
download | ether-6cfe247b362106543bbb1a835dde9e7da9128fee.tar.gz ether-6cfe247b362106543bbb1a835dde9e7da9128fee.tar.bz2 ether-6cfe247b362106543bbb1a835dde9e7da9128fee.zip |
fixed jitter while moving and zooming
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/game.h | 3 | ||||
-rw-r--r-- | src/renderer.cpp | 12 |
3 files changed, 6 insertions, 11 deletions
diff --git a/src/game.cpp b/src/game.cpp index 31c682c..f048400 100644 --- a/src/game.cpp +++ b/src/game.cpp | |||
@@ -613,8 +613,6 @@ void Game::setZoom(size_t zoom) | |||
613 | return; | 613 | return; |
614 | } | 614 | } |
615 | 615 | ||
616 | /*zoomProgress = 0; | ||
617 | zoomLength = std::abs(static_cast<long>(zoom - curZoom)) * TILE_WIDTH;*/ | ||
618 | zoomProgress.start(62 * std::abs(static_cast<long>(zoom) - curZoom) * TILE_WIDTH); | 616 | zoomProgress.start(62 * std::abs(static_cast<long>(zoom) - curZoom) * TILE_WIDTH); |
619 | oldZoom = curZoom; | 617 | oldZoom = curZoom; |
620 | curZoom = zoom; | 618 | curZoom = zoom; |
diff --git a/src/game.h b/src/game.h index 0c4c89f..a70f57e 100644 --- a/src/game.h +++ b/src/game.h | |||
@@ -86,8 +86,6 @@ public: | |||
86 | int curZoom = INIT_ZOOM; | 86 | int curZoom = INIT_ZOOM; |
87 | int oldZoom = INIT_ZOOM; | 87 | int oldZoom = INIT_ZOOM; |
88 | bool zooming = false; | 88 | bool zooming = false; |
89 | //int zoomProgress = 0; | ||
90 | //int zoomLength; | ||
91 | Interpolation zoomProgress; | 89 | Interpolation zoomProgress; |
92 | 90 | ||
93 | double getZoomBasis() const { return zooming ? std::max(curZoom, oldZoom) : curZoom; } | 91 | double getZoomBasis() const { return zooming ? std::max(curZoom, oldZoom) : curZoom; } |
@@ -105,7 +103,6 @@ public: | |||
105 | Timer inputTimer = {50}; | 103 | Timer inputTimer = {50}; |
106 | Timer losePopLampTimer = {800}; | 104 | Timer losePopLampTimer = {800}; |
107 | Timer losePopPlayerTimer = {3000}; | 105 | Timer losePopPlayerTimer = {3000}; |
108 | //Timer zoomTimer = {62}; | ||
109 | 106 | ||
110 | std::vector<std::string> signTexts; | 107 | std::vector<std::string> signTexts; |
111 | int nextSignIndex = 0; | 108 | int nextSignIndex = 0; |
diff --git a/src/renderer.cpp b/src/renderer.cpp index 94be197..b90372e 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp | |||
@@ -370,19 +370,19 @@ void Renderer::renderGame( | |||
370 | 370 | ||
371 | if (game.moving) { | 371 | if (game.moving) { |
372 | if (game.player_x > game.player_oldx) { | 372 | if (game.player_x > game.player_oldx) { |
373 | oldRect.x += game.moveProgress.getProgress(0, TILE_WIDTH); | ||
374 | zoomRect.x += game.moveProgress.getProgress(0, TILE_WIDTH); | ||
375 | } else if (game.player_x < game.player_oldx) { | ||
376 | oldRect.x -= game.moveProgress.getProgress(TILE_WIDTH, 0); | 373 | oldRect.x -= game.moveProgress.getProgress(TILE_WIDTH, 0); |
377 | zoomRect.x -= game.moveProgress.getProgress(TILE_WIDTH, 0); | 374 | zoomRect.x -= game.moveProgress.getProgress(TILE_WIDTH, 0); |
375 | } else if (game.player_x < game.player_oldx) { | ||
376 | oldRect.x += game.moveProgress.getProgress(TILE_WIDTH, 0); | ||
377 | zoomRect.x += game.moveProgress.getProgress(TILE_WIDTH, 0); | ||
378 | } | 378 | } |
379 | 379 | ||
380 | if (game.player_y > game.player_oldy) { | 380 | if (game.player_y > game.player_oldy) { |
381 | oldRect.y += game.moveProgress.getProgress(0, TILE_HEIGHT); | ||
382 | zoomRect.y += game.moveProgress.getProgress(0, TILE_HEIGHT); | ||
383 | } else if (game.player_y < game.player_oldy) { | ||
384 | oldRect.y -= game.moveProgress.getProgress(TILE_HEIGHT, 0); | 381 | oldRect.y -= game.moveProgress.getProgress(TILE_HEIGHT, 0); |
385 | zoomRect.y -= game.moveProgress.getProgress(TILE_HEIGHT, 0); | 382 | zoomRect.y -= game.moveProgress.getProgress(TILE_HEIGHT, 0); |
383 | } else if (game.player_y < game.player_oldy) { | ||
384 | oldRect.y += game.moveProgress.getProgress(TILE_HEIGHT, 0); | ||
385 | zoomRect.y += game.moveProgress.getProgress(TILE_HEIGHT, 0); | ||
386 | } | 386 | } |
387 | } | 387 | } |
388 | 388 | ||