diff --git a/assets/tiles/down.png b/assets/tiles/down.png index 9f40dea..34d8dba 100644 Binary files a/assets/tiles/down.png and b/assets/tiles/down.png differ diff --git a/assets/tiles/left.png b/assets/tiles/left.png index 5bb4a87..d901c91 100644 Binary files a/assets/tiles/left.png and b/assets/tiles/left.png differ diff --git a/assets/tiles/mirror_back.png b/assets/tiles/mirror_back.png index 543dacc..3f857d3 100644 Binary files a/assets/tiles/mirror_back.png and b/assets/tiles/mirror_back.png differ diff --git a/assets/tiles/mirror_forward.png b/assets/tiles/mirror_forward.png index a333771..edcae30 100644 Binary files a/assets/tiles/mirror_forward.png and b/assets/tiles/mirror_forward.png differ diff --git a/assets/tiles/right.png b/assets/tiles/right.png index f3dc6b9..1d21e5d 100644 Binary files a/assets/tiles/right.png and b/assets/tiles/right.png differ diff --git a/assets/tiles/up.png b/assets/tiles/up.png index 956e270..561badf 100644 Binary files a/assets/tiles/up.png and b/assets/tiles/up.png differ diff --git a/src/main.rs b/src/main.rs index a50f066..74f3eca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -154,7 +154,8 @@ impl Game { self.machine .board() .draw(d, textures, self.view_offset, self.zoom); - self.machine.draw_marble_values(d, self.view_offset, self.zoom); + self.machine + .draw_marble_values(d, self.view_offset, self.zoom); } } @@ -172,7 +173,7 @@ impl Game { Color::new(32, 32, 32, 255), ); - let tile_size = (16 << 1) as f32; + let tile_size = (16 << self.zoom) as f32; let grid_spill_x = (self.view_offset.x).rem(tile_size) - tile_size; let grid_spill_y = (self.view_offset.y).rem(tile_size) - tile_size; d.gui_grid( diff --git a/src/marble_engine.rs b/src/marble_engine.rs index 05f7516..1952294 100644 --- a/src/marble_engine.rs +++ b/src/marble_engine.rs @@ -75,11 +75,11 @@ impl Machine { if let Some(tile) = self.board.get((x, y).into()) { let px = x as i32 * tile_size + offset.x as i32 + tile_size / 2; let py = y as i32 * tile_size + offset.y as i32 + tile_size / 2; - if let Tile::Marble { value, dir } = tile{ + if let Tile::Marble { value, dir: _ } = tile { d.draw_text( &format!("{value}"), px - tile_size / 2 + 2, - py - tile_size / 2 + 2, + py - tile_size / 2 + 2, 20, Color::MAGENTA, ) diff --git a/src/marble_engine/board.rs b/src/marble_engine/board.rs index b1ca44e..722a981 100644 --- a/src/marble_engine/board.rs +++ b/src/marble_engine/board.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; -use raylib::prelude::*; use super::tile::*; +use raylib::prelude::*; #[derive(Debug, Default, Clone, Copy, PartialEq)] pub struct Pos { @@ -94,7 +94,7 @@ impl Board { textures: &HashMap, offset: Vector2, zoom: i32, - ){ + ) { let tile_size = 16 << zoom; for x in 0..self.width { for y in 0..self.height { diff --git a/src/marble_engine/tile.rs b/src/marble_engine/tile.rs index aea08e1..1fd4550 100644 --- a/src/marble_engine/tile.rs +++ b/src/marble_engine/tile.rs @@ -92,7 +92,7 @@ impl Tile { x: i32, y: i32, size: i32, - zoom:i32, + zoom: i32, ) { let tex_name = match self { Tile::Blank => "", @@ -145,7 +145,7 @@ impl Tile { texture, Vector2::new((x - size / 2) as f32, (y - size / 2) as f32), 0.0, - (1< (), - Tile::Block => d.draw_rectangle(x - size / 2, y - size / 2, size, size, Color::DIMGRAY), Tile::Comment(c) => { d.draw_rectangle(x - size / 2, y - size / 2, size, size, Color::DIMGRAY); d.draw_text(&format!("{}", *c as char), x - 10, y - 10, 20, Color::WHITE); } - Tile::Marble { value, dir } => { - d.draw_circle(x, y, size as f32 * 0.35, Color::new(15, 15, 15, 255)); - d.draw_text( - &format!("{value}"), - x - size / 2 + 2, - y - size / 2 + 2, - 20, - Color::MAGENTA, - ); - } Tile::Digit(n) => { d.draw_text(&String::from(*n as char), x - 10, y - 10, 20, Color::ORANGE) } - Tile::Mirror(mirror) => { - let height = size as f32 * 1.25; - let width = (size / 4) as f32; - let rec = Rectangle { - x: x as f32, - y: y as f32, - width, - height, - }; - let rot = match mirror { - MirrorType::Forward => 45.0, - MirrorType::Back => -45.0, - }; - d.draw_rectangle_pro(rec, Vector2::new(width, height) * 0.5, rot, Color::CYAN); - } - _ => d.draw_rectangle(x - size / 2, y - size / 2, size, size, Color::YELLOW), + _ => d.draw_rectangle(x - size / 2, y - size / 2, size, size, Color::RED), } } }