Add support for sprite transparencies.

Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian.Conlon 2017-09-15 17:37:57 +01:00
parent f6181400c4
commit 94fe1a7494

View File

@ -68,6 +68,7 @@ void EightBit::GameBoy::Display::renderObjects(int objBlockHeight) {
const auto spriteY = current.positionY();
const auto& palette = palettes[current.palette()];
// TODO: x/y flip
for (int cy = 0; cy < 8; ++cy) {
for (int cx = 0; cx < 8; ++cx) {
@ -81,8 +82,9 @@ void EightBit::GameBoy::Display::renderObjects(int objBlockHeight) {
auto outputPixel = y * RasterWidth + x;
auto colour = palette[definition.get()[cy * 8 + cx]];
m_pixels[outputPixel] = m_colours->getColour(colour);
auto colour = definition.get()[cy * 8 + cx];
if (colour > 0) // transparency
m_pixels[outputPixel] = m_colours->getColour(palette[colour]);
}
}
}