Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Dec 10, 2023
1 parent cab18ef commit c9144d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct GPU {
lcdc: LCDC,
lcds: LCDS,
ram: [u8; 0x4000],
frame_buffer: [[[u8; 3]; SCREEN_W]; SCREEN_H]
frame_buffer: [[[u8; 4]; SCREEN_W]; SCREEN_H]
}

bitflags! {
Expand Down Expand Up @@ -67,7 +67,7 @@ impl GPU {
lcdc: LCDC::empty(),
lcds: LCDS::empty(),
ram: [0; 0x4000],
frame_buffer: [[[0; 3]; SCREEN_W]; SCREEN_H]
frame_buffer: [[[0; 4]; SCREEN_W]; SCREEN_H]
}
}

Expand All @@ -86,7 +86,7 @@ impl GPU {

fn set_rgb(&mut self, x: usize, r: u8, g: u8, b: u8) {
// TODO: Color mapping from CGB -> sRGB
self.frame_buffer[self.ly as usize][x] = [r, g, b];
self.frame_buffer[self.ly as usize][x] = [r, g, b, 0xFF];
}

fn draw_bg(&mut self) {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async fn main() -> Result<(), impl std::error::Error> {
tokio::spawn(async move {
let mut cpu = CPU::new(GBMode::Classic, buffer_copy);

while true {
loop {
let cycles = cpu.cycle();
cpu.mem.gpu.cycle();

Expand Down

0 comments on commit c9144d6

Please sign in to comment.