From 1e84e2d6ef9370a3443fcd8472779184f6319594 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 15 Mar 2022 11:32:14 -0400 Subject: maybe made the slowdown when zoomed out much better --- src/game.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index fc57acc..e9a9fbe 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -55,7 +55,7 @@ void Game::tick( bool invert, bool onlyDark) { - std::vector temp(map.data()); + mapDoubleBuffer = map.data(); for (int y = map.getTop(); y < map.getBottom(); y++) { @@ -91,19 +91,19 @@ void Game::tick( int tempIndex = map.getTrueX(x) + map.getTrueY(y) * map.getWidth(); if (count >= 5) { - temp[tempIndex].tile = Tile::Wall; + mapDoubleBuffer[tempIndex].tile = Tile::Wall; } else { - temp[tempIndex].tile = Tile::Floor; + mapDoubleBuffer[tempIndex].tile = Tile::Floor; } - if (temp[tempIndex].tile != map.at(x,y).tile) { - temp[tempIndex].dirtyRender = true; + if (mapDoubleBuffer[tempIndex].tile != map.at(x,y).tile) { + mapDoubleBuffer[tempIndex].dirtyRender = true; dirtyRender = true; } } } - map.data() = std::move(temp); + std::swap(map.data(), mapDoubleBuffer); } void Game::tick(bool onlyDark) -- cgit 1.4.1