mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-10 10:29:43 +00:00
Add support for sprite transparencies.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
f6181400c4
commit
94fe1a7494
@ -68,6 +68,7 @@ void EightBit::GameBoy::Display::renderObjects(int objBlockHeight) {
|
|||||||
const auto spriteY = current.positionY();
|
const auto spriteY = current.positionY();
|
||||||
const auto& palette = palettes[current.palette()];
|
const auto& palette = palettes[current.palette()];
|
||||||
|
|
||||||
|
// TODO: x/y flip
|
||||||
for (int cy = 0; cy < 8; ++cy) {
|
for (int cy = 0; cy < 8; ++cy) {
|
||||||
for (int cx = 0; cx < 8; ++cx) {
|
for (int cx = 0; cx < 8; ++cx) {
|
||||||
|
|
||||||
@ -81,8 +82,9 @@ void EightBit::GameBoy::Display::renderObjects(int objBlockHeight) {
|
|||||||
|
|
||||||
auto outputPixel = y * RasterWidth + x;
|
auto outputPixel = y * RasterWidth + x;
|
||||||
|
|
||||||
auto colour = palette[definition.get()[cy * 8 + cx]];
|
auto colour = definition.get()[cy * 8 + cx];
|
||||||
m_pixels[outputPixel] = m_colours->getColour(colour);
|
if (colour > 0) // transparency
|
||||||
|
m_pixels[outputPixel] = m_colours->getColour(palette[colour]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user