Browse Source

Cleanup

master
e-dt 4 years ago
parent
commit
7f9bf67163
  1. 10
      src/apr.rs

10
src/apr.rs

@ -104,8 +104,7 @@ impl EventHandler for Apr {
}
actor::ActorPosn::BoardPosn { x, y } => {
if mouse::button_pressed(ctx, MouseButton::Left) {
let (posx, posy) =
self.board.closest_square_coords(posn.x, posn.y);
let (posx, posy) = self.board.closest_square_coords(posn.x, posn.y);
if posx == x && posy == y {
let x = board::START_X + board::BOARD_SQUARE_SIZE * (x as f32);
let y = board::START_Y + board::BOARD_SQUARE_SIZE * (y as f32);
@ -128,7 +127,12 @@ impl EventHandler for Apr {
let drawparams = graphics::DrawParam::new();
if self.should_update_grid {
self.grid = make_grid(ctx, self.board.row, self.board.col, self.board.board.as_slice())?;
self.grid = make_grid(
ctx,
self.board.row,
self.board.col,
self.board.board.as_slice(),
)?;
self.should_update_grid = false;
}
graphics::draw(ctx, &self.grid, drawparams)?;

Loading…
Cancel
Save