From c3055098edaec16f844fc21731ecf391c8fefe33 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 14 Mar 2022 20:34:47 -0400 Subject: fixed weird shadows while moving --- src/renderer.cpp | 26 ++------------------------ src/renderer.h | 2 -- 2 files changed, 2 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/renderer.cpp b/src/renderer.cpp index 139b493..87e6553 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -299,8 +299,8 @@ void Renderer::renderGame( if (!game.map.at(x,y).litTiles.count({sx, sy})) { SDL_Rect rect { - (sx - leftmost) * TILE_WIDTH + xInterp, - (sy - topmost) * TILE_HEIGHT + yInterp, + (sx - leftmost) * TILE_WIDTH, + (sy - topmost) * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT}; @@ -390,28 +390,6 @@ void Renderer::renderTitle(int num, double fade) { SDL_RenderPresent(ren_.get()); } -std::tuple Renderer::calculateZoomRect(const Game& game) -{ - int w = game.curZoom * TILE_WIDTH * ZOOM_X_FACTOR; - int h = game.curZoom * TILE_HEIGHT * ZOOM_Y_FACTOR; - int x = (game.map.getTrueX(game.player_x) * TILE_WIDTH) - (w / 2); - int y = (game.map.getTrueY(game.player_y) * TILE_HEIGHT) - (h / 2); - - /*if (game.zooming) - { - double interp = - static_cast(game.zoomProgress) / - static_cast(game.zoomLength); - - x = (x - game.lastZoomLeft) * interp + game.lastZoomLeft; - y = (y - game.lastZoomTop) * interp + game.lastZoomTop; - w = (w - game.lastZoomWidth) * interp + game.lastZoomWidth; - h = (h - game.lastZoomHeight) * interp + game.lastZoomHeight; - }*/ - - return {x, y, w, h}; -} - void Renderer::loadTextureFromFile(std::string_view path, texture_ptr& texture) { surface_ptr pfs(IMG_Load(path.data())); if (!pfs) diff --git a/src/renderer.h b/src/renderer.h index 4d5484c..1364550 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -122,8 +122,6 @@ public: void renderTitle(int num, double fade); - static std::tuple calculateZoomRect(const Game& game); - private: void loadTextureFromFile(std::string_view path, texture_ptr& texture); -- cgit 1.4.1