diff --git a/sources/PPU/Background.cpp b/sources/PPU/Background.cpp index 5dd7bf1..f87a9b1 100644 --- a/sources/PPU/Background.cpp +++ b/sources/PPU/Background.cpp @@ -59,7 +59,7 @@ namespace ComSquare::PPU palette = getPalette(tileData.palette); // X horizontal // Y vertical - graphicAddress = this->_tilesetAddress + (tileData.posY * 16 * this->_bpp * 8) + (tileData.posX * this->_bpp * 8); + graphicAddress = this->_tilesetAddress + (tileData.posY * NB_TILE_PER_ROW * this->_bpp * TILE_SIZE) + (tileData.posX * this->_bpp * TILE_SIZE); for (int i = 0; i < this->_characterSize.y; i++) { index = i * this->_characterSize.x; if (tileData.verticalFlip) diff --git a/sources/PPU/Background.hpp b/sources/PPU/Background.hpp index 89c66a6..de9ae95 100644 --- a/sources/PPU/Background.hpp +++ b/sources/PPU/Background.hpp @@ -23,6 +23,8 @@ namespace ComSquare::PPU #define NB_CHARACTER_HEIGHT 32 #define TILE_PIXEL_WIDTH 8U #define TILE_PIXEL_HEIGHT 8U + #define TILE_SIZE 8 + #define NB_TILE_PER_ROW 16 private: Vector2 _tileMaps; Vector2 _characterSize;