diff --git a/src/board.rs b/src/board.rs index 0157d07..36b4192 100644 --- a/src/board.rs +++ b/src/board.rs @@ -69,16 +69,16 @@ impl Board { pub fn draw_comments(&self, offset: Vec2, scale: f32) { let tile_size = TILE_TEXTURE_SIZE * scale; - let font_size = 10. * scale .max(1.); - let line_space = 12. * scale .max(1.); + let font_size = 10. * scale.max(1.); + let line_space = 12. * scale.max(1.); for comment in &self.comments { - let x = comment.x as f32 * tile_size + offset.x ; - let y = comment.y as f32 * tile_size + offset.y ; + let x = comment.x as f32 * tile_size + offset.x; + let y = comment.y as f32 * tile_size + offset.y; let y = y + (tile_size - font_size) / 2.; // center vertically in the grid row for (i, line) in comment.text.lines().enumerate() { let y = y + line_space * i as f32; - draw_text(line, x, y, font_size, colors::ORANGE); + draw_text(line, x, y, font_size, colors::ORANGE); } } } diff --git a/src/config.rs b/src/config.rs index d0a7428..996e1bf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -60,7 +60,7 @@ impl Config { toggle(&mut self.show_debug_timing, "show debug timing"); // self.input.update(d); - self.input.draw_edit( globals, y); + self.input.draw_edit(globals, y); MenuReturn::Stay } } diff --git a/src/main.rs b/src/main.rs index 0e7c26f..86f973a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,6 @@ async fn main() { // set_window_min_size(640, 480); set_mouse_cursor(miniquad::CursorIcon::Crosshair); - let mut game = Game::new().await; game.run().await } @@ -223,7 +222,13 @@ impl Game { .get(self.selected_level.0) .and_then(|c| c.levels.get(self.selected_level.1)) { - draw_text(level.name(), level_list_width + 10., 10., 40., colors::SKYBLUE); + draw_text( + level.name(), + level_list_width + 10., + 10., + 40., + colors::SKYBLUE, + ); draw_text(level.id(), level_list_width + 10., 50., 10., colors::GRAY); let mut y = 70.; @@ -271,7 +276,7 @@ impl Game { colors::WHITE, ); if tex32_button( - &self.globals.mouse, + &self.globals.mouse, (level_list_width + entry_width + 15., solution_y + 4.), self.globals.get_tex("cancel"), (&mut tooltip, "delete"), diff --git a/src/marble_engine/grid.rs b/src/marble_engine/grid.rs index d5e3e9b..77346dc 100644 --- a/src/marble_engine/grid.rs +++ b/src/marble_engine/grid.rs @@ -285,17 +285,11 @@ impl Grid { out } - pub fn draw( - &self, - textures: &Textures, - offset: Vec2, - scale: f32, - power_directions: bool, - ) { + pub fn draw(&self, textures: &Textures, offset: Vec2, scale: f32, power_directions: bool) { let tile_size = (TILE_TEXTURE_SIZE * scale) as i32; let start_x = (-offset.x as i32) / tile_size - 1; - let tiles_width = screen_width() as i32/ tile_size + 3; + let tiles_width = screen_width() as i32 / tile_size + 3; let start_y = (-offset.y as i32) / tile_size - 1; let tiles_height = screen_height() as i32 / tile_size + 3; @@ -309,19 +303,25 @@ impl Grid { continue; } let texture = textures.get(texname); - draw_scaled_texture( texture, px, py, scale); + draw_scaled_texture(texture, px, py, scale); if power_directions { if let Tile::Powerable(_, state) = &tile { for dir in Direction::ALL { if state.get_dir(dir) { let texture = textures.get(dir.debug_arrow_texture_name()); - draw_scaled_texture( texture, px, py, scale); + draw_scaled_texture(texture, px, py, scale); } } } } } else { - draw_rectangle(px, py, tile_size as _, tile_size as _, Color::from_rgba(0, 0, 0, 80)); + draw_rectangle( + px, + py, + tile_size as _, + tile_size as _, + Color::from_rgba(0, 0, 0, 80), + ); } } } diff --git a/src/theme.rs b/src/theme.rs index 2fcec51..62ba513 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -12,7 +12,7 @@ pub const BG_WIDGET: Color = gray(64); pub const BG_WIDGET_ACTIVE: Color = rgb(80, 120, 180); pub const FG_MARBLE_VALUE: Color = rgb(255, 80, 40); pub const FG_CHAPTER_TITLE: Color = rgb(255, 160, 40); -pub const SLIDER_FILL: Color = rgb(255, 160, 40); +pub const SLIDER_FILL: Color = rgb(255, 160, 40); pub const LIGHTBLUE: Color = rgb(80, 190, 230); pub const fn widget_bg(highlight: bool) -> Color { diff --git a/src/util.rs b/src/util.rs index f9fedf6..243593d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -31,15 +31,11 @@ pub fn userdata_dir() -> PathBuf { PathBuf::from("user") } -pub fn draw_rectangle_rec(bounds: Rect, color: Color){ - draw_rectangle( - bounds.x, - bounds.y, - bounds.w, - bounds.h,color); +pub fn draw_rectangle_rec(bounds: Rect, color: Color) { + draw_rectangle(bounds.x, bounds.y, bounds.w, bounds.h, color); } -pub fn draw_scaled_texture_c(texture: &Texture2D, x: f32, y: f32, scale: f32, color:Color) { +pub fn draw_scaled_texture_c(texture: &Texture2D, x: f32, y: f32, scale: f32, color: Color) { let params = DrawTextureParams { dest_size: Some(Vec2::new(texture.width() * scale, texture.height() * scale)), ..Default::default() @@ -47,7 +43,6 @@ pub fn draw_scaled_texture_c(texture: &Texture2D, x: f32, y: f32, scale: f32, co draw_texture_ex(texture, x, y, color, params); } - pub fn draw_scaled_texture(texture: &Texture2D, x: f32, y: f32, scale: f32) { let params = DrawTextureParams { dest_size: Some(Vec2::new(texture.width() * scale, texture.height() * scale)),