mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-06 03:15:48 -06:00
reformat: default debug off, conditional debug grid rendering, remove unused redraw()
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user