Skip to content

Commit

Permalink
Object Limit
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Feb 1, 2024
1 parent ddcaaec commit 84b65cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ impl PPU {

fn draw_sprites(&mut self) {
let sprite_size = if self.lcdc.contains(LCDC::OBJ_SIZE) { 16 } else { 8 };
let mut object_count = 0;

for i in 0..40 {
let sprite_address = 0xFE00 + (i as u16) * 4;
Expand Down Expand Up @@ -435,6 +436,11 @@ impl PPU {
[b1, b2]
};

object_count += 1;
if object_count > 10 {
continue;
}

for x in 0..8 {
if px.wrapping_add(x) >= (SCREEN_W as u8) {
continue;
Expand Down

0 comments on commit 84b65cd

Please sign in to comment.