diff --git a/src/game.rs b/src/game.rs index 11e5c26..eec8a26 100644 --- a/src/game.rs +++ b/src/game.rs @@ -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(); + } } } diff --git a/src/main.rs b/src/main.rs index 565514f..b1763d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,14 +16,6 @@ mod pacman; mod entity; mod animation; -fn redraw(canvas: &mut Canvas, 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");