diff --git a/sources/PPU/Background.cpp b/sources/PPU/Background.cpp index e7c3dd2..cc6160c 100644 --- a/sources/PPU/Background.cpp +++ b/sources/PPU/Background.cpp @@ -93,11 +93,11 @@ namespace ComSquare::PPU for (int i = 0; i < this->_characterNbPixels.y; i++) { for (int j = 0; j < this->_characterNbPixels.x; j++) { //std::copy(this->_tileBuffer.begin(), this->_tileBuffer.begin() + this->_characterNbPixels.x, this->buffer[pos.x].begin() ) - this->buffer[pos.x][pos.y] = this->_tileBuffer[i][j]; - pos.x++; + this->buffer[pos.y + i][pos.x + j] = this->_tileBuffer[i][j]; + //pos.x++; } - pos.x -= this->_characterNbPixels.x; - pos.y++; + //pos.x -= this->_characterNbPixels.x; + //pos.y++; } } diff --git a/sources/PPU/PPU.cpp b/sources/PPU/PPU.cpp index c64a7d1..4d28a25 100644 --- a/sources/PPU/PPU.cpp +++ b/sources/PPU/PPU.cpp @@ -36,7 +36,7 @@ namespace ComSquare::PPU { this->_registers._isLowByte = true; - //Utils::Debug::populateEnvironment(*this, 0); + Utils::Debug::populateEnvironment(*this, 1); } uint8_t PPU::read(uint24_t addr) @@ -316,7 +316,7 @@ namespace ComSquare::PPU //add_buffer(this->_screen, this->_backgrounds[2].buffer); for (unsigned long i = 0; i < this->_screen.size(); i++) { for (unsigned long j = 0; j < this->_screen[i].size(); j++) { - this->_renderer.putPixel(j, i, this->_screen[i][j]); + this->_renderer.putPixel(i, j, this->_screen[i][j]); } } this->_renderer.drawScreen(); @@ -542,11 +542,10 @@ namespace ComSquare::PPU Vector2 PPU::getBackgroundMirroring(int bgNumber) const { - Vector2 backgroundSize(false, false); - - backgroundSize.y = this->_registers._bgsc[bgNumber - 1].tilemapVerticalMirroring; - backgroundSize.x = this->_registers._bgsc[bgNumber - 1].tilemapHorizontalMirroring; - return backgroundSize; + return { + static_cast(this->_registers._bgsc[bgNumber - 1].tilemapVerticalMirroring), + static_cast(this->_registers._bgsc[bgNumber - 1].tilemapHorizontalMirroring) + }; } void PPU::renderMainAndSubScreen() diff --git a/sources/Renderer/SFRenderer.cpp b/sources/Renderer/SFRenderer.cpp index 8bb23fe..3579163 100644 --- a/sources/Renderer/SFRenderer.cpp +++ b/sources/Renderer/SFRenderer.cpp @@ -68,8 +68,7 @@ namespace ComSquare::Renderer if (y >= this->_videoMode.height) throw InvalidPixelPosition("Height", y, this->_videoMode.height); - sf::Color pixels(rgba); - this->_pixelBuffer[this->_videoMode.width * y + x] = pixels; + this->_pixelBuffer[this->_videoMode.width * y + x] = sf::Color(rgba); } void SFRenderer::getEvents()