HflipArray and VFLipArray aren't working

This commit is contained in:
Clément Le Bihan
2021-06-09 00:55:38 +02:00
parent daa7e285d1
commit 17607d6fcb
5 changed files with 73 additions and 15 deletions
+4 -1
View File
@@ -29,10 +29,12 @@ namespace ComSquare::PPU
{
std::vector<uint16_t> palette = this->getPalette(this->_paletteIndex);
int it = 0;
this->buffer = {{{0}}};
for (auto &row : this->buffer) {
for (auto &pixel : row) {
pixel = getRealColor(palette[this->getPixelReferenceFromTile(tileAddress, it++)]);
uint8_t pixelReference = this->getPixelReferenceFromTile(tileAddress, it++);
pixel = pixelReference ? getRealColor(palette[pixelReference]) : 0;
}
}
}
@@ -102,6 +104,7 @@ namespace ComSquare::PPU
std::vector<uint16_t> TileRenderer::getPalette(int nbPalette)
{
// todo if needed the tile renderer could cache the palette to avoid recompute this every render
uint16_t nbColors = std::pow(2, this->_bpp);
uint16_t addr = nbPalette * this->_bpp * this->_bpp * 2; // 2 because it's 2 addr for 1 color
std::vector<uint16_t> palette(nbColors);