mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-08 11:29:26 +00:00
X/Y sprite flip implemented. Easy!
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
94fe1a7494
commit
e40ee1d7a6
@ -67,19 +67,21 @@ void EightBit::GameBoy::Display::renderObjects(int objBlockHeight) {
|
||||
const auto spriteX = current.positionX();
|
||||
const auto spriteY = current.positionY();
|
||||
const auto& palette = palettes[current.palette()];
|
||||
const auto flipX = current.flipX();
|
||||
const auto flipY = current.flipY();
|
||||
|
||||
// TODO: x/y flip
|
||||
for (int cy = 0; cy < 8; ++cy) {
|
||||
|
||||
uint8_t y = spriteY + (flipY ? 7 - cy : cy);
|
||||
if (y >= RasterHeight)
|
||||
break;
|
||||
|
||||
for (int cx = 0; cx < 8; ++cx) {
|
||||
|
||||
uint8_t x = spriteX + cx;
|
||||
uint8_t x = spriteX + (flipX ? 7 - cx : cx);
|
||||
if (x >= RasterWidth)
|
||||
break;
|
||||
|
||||
uint8_t y = spriteX + cy;
|
||||
if (y >= RasterHeight)
|
||||
break;
|
||||
|
||||
auto outputPixel = y * RasterWidth + x;
|
||||
|
||||
auto colour = definition.get()[cy * 8 + cx];
|
||||
|
Loading…
Reference in New Issue
Block a user