reformat: default debug off, conditional debug grid rendering, remove unused redraw()

This commit is contained in:
2023-09-09 18:23:32 -05:00
parent f7ff9f5290
commit e61930c08a
2 changed files with 4 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ impl Game<'_> {
Game {
canvas,
pacman: pacman,
debug: true,
debug: false,
map_texture: texture_creator
.load_texture("assets/map.png")
.expect("Could not load pacman texture"),
@@ -74,6 +74,7 @@ impl Game<'_> {
self.pacman.render(self.canvas);
// Draw a grid
if self.debug {
for x in 0..BOARD_WIDTH {
for y in 0..BOARD_HEIGHT {
let tile = BOARD[x as usize][y as usize];
@@ -93,7 +94,6 @@ impl Game<'_> {
}
}
}
self.canvas.present();
}
}
}

View File

@@ -16,14 +16,6 @@ mod pacman;
mod entity;
mod animation;
fn redraw(canvas: &mut Canvas<sdl2::video::Window>, tex: &Texture, i: u8) {
canvas.set_draw_color(Color::RGB(i, i, i));
canvas.clear();
canvas
.copy(tex, None, None)
.expect("Could not render texture on canvas");
}
pub fn main() {
let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
@@ -36,6 +28,7 @@ pub fn main() {
let mut canvas = window
.into_canvas()
.accelerated()
.build()
.expect("Could not build canvas");