Skip to content

Commit

Permalink
Remove unused sprite flags
Browse files Browse the repository at this point in the history
  • Loading branch information
joajfreitas committed Jul 28, 2024
1 parent 37c27ec commit 06a92b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
1 change: 0 additions & 1 deletion fpt/src/bw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub fn test_bit16<const INDEX: u8>(word: u16) -> bool {
word & mask == mask
}

//#[allow(unused)]
pub fn get_bit8<const INDEX: u8>(word: u8) -> u8 {
(word >> INDEX) & 0x1
}
Expand Down
48 changes: 23 additions & 25 deletions fpt/src/ppu/sprite.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
use crate::bw::test_bit8;
//#[derive(Debug)]
//pub struct Flags {
// pub priority: bool,
// pub y_flip: bool,
// pub x_flip: bool,
// pub dmg_palette: u8,
// pub bank: bool,
// pub cgb_palette: u8,
//}

#[derive(Debug)]
pub struct Flags {
//pub priority: bool,
pub y_flip: bool,
pub x_flip: bool,
//pub dmg_palette: u8,
//pub bank: bool,
//pub cgb_palette: u8,
}

impl Flags {
pub fn from(memory: u8) -> Flags {
Flags {
//priority: test_bit8::<7>(memory),
x_flip: test_bit8::<6>(memory),
y_flip: test_bit8::<5>(memory),
//dmg_palette: (memory >> 4) & 0b11,
//bank: test_bit8::<3>(memory),
//cgb_palette: memory & 0b111,
}
}
}
//impl Flags {
// pub fn from(memory: u8) -> Flags {
// Flags {
// //priority: test_bit8::<7>(memory),
// x_flip: test_bit8::<6>(memory),
// y_flip: test_bit8::<5>(memory),
// //dmg_palette: (memory >> 4) & 0b11,
// //bank: test_bit8::<3>(memory),
// //cgb_palette: memory & 0b111,
// }
// }
//}

#[derive(Debug)]
pub struct Sprite {
pub y: u8,
pub x: u8,
pub tile_index: u8,
pub flags: Flags,
//pub flags: Flags,
}

impl Sprite {
Expand All @@ -37,7 +35,7 @@ impl Sprite {
y: memory[0],
x: memory[1],
tile_index: memory[2],
flags: Flags::from(memory[3]),
//flags: Flags::from(memory[3]),
}
}
}

0 comments on commit 06a92b0

Please sign in to comment.