From bae1908c3b1c6245f801e0c00a4088c212d56948 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 27 Oct 2019 19:48:32 -0500 Subject: [PATCH] [nostalgia/core] Cleanup --- src/nostalgia/core/sdl/gfx.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/nostalgia/core/sdl/gfx.cpp b/src/nostalgia/core/sdl/gfx.cpp index b5ad8a23..b2dcdb72 100644 --- a/src/nostalgia/core/sdl/gfx.cpp +++ b/src/nostalgia/core/sdl/gfx.cpp @@ -122,7 +122,7 @@ ox::Error loadTileSheet(Context *ctx, return OxError(0); } -void drawBackground(std::size_t bg) { +void drawBackground(SDL_Texture *tex) { //oxTrace("nostalgia::core::drawBackground") << "Drawing background"; SDL_Rect src = {}, dst = {}; src.x = 0; @@ -132,7 +132,6 @@ void drawBackground(std::size_t bg) { dst.y = 0; dst.w = 64; dst.h = 64; - const auto tex = bgTextures[bg]; if (tex) { for (auto &m : bgTileMaps) { for (auto t : m) { @@ -148,10 +147,9 @@ void drawBackground(std::size_t bg) { void draw() { SDL_RenderClear(renderer); - drawBackground(0); - drawBackground(1); - drawBackground(2); - drawBackground(3); + for (auto tex : bgTextures) { + drawBackground(tex); + } SDL_RenderPresent(renderer); }