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