diff --git a/src/editor.rs b/src/editor.rs index 22d72f0..6248441 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -509,8 +509,8 @@ impl Editor { let mouse_pos = self.mouse.pos(); if (self.active_tool != Tool::Blueprint || self.sim_state != SimState::Editing - || mouse_pos.x > SIDEBAR_WIDTH as f32) - && mouse_pos.y > HEADER_HEIGHT as f32 + || mouse_pos.x > SIDEBAR_WIDTH) + && mouse_pos.y > HEADER_HEIGHT && (mouse_pos.y) < (screen_height() - FOOTER_HEIGHT) { match self.mouse.scroll() { @@ -732,7 +732,7 @@ impl Editor { let mut text_selected = is_selected && self.blueprint_name_selected; text_input( globals, - Rect::new(42., y as f32, 200., 32.), + Rect::new(42., y, 200., 32.), &mut b.name, &mut text_selected, 32, @@ -1032,7 +1032,7 @@ impl Editor { fn draw_bottom_bar(&mut self, globals: &mut Globals) { let height = screen_height(); - let footer_top = (height - FOOTER_HEIGHT) as f32; + let footer_top = height - FOOTER_HEIGHT; // background draw_rectangle( 0., @@ -1341,7 +1341,7 @@ impl Editor { } fn board_overlay(&mut self, globals: &Globals) { - let footer_top = (screen_height() - FOOTER_HEIGHT) as f32; + let footer_top = screen_height() - FOOTER_HEIGHT; let tile_size = TILE_TEXTURE_SIZE * self.zoom; if self.sim_state == SimState::Editing { @@ -1350,7 +1350,7 @@ impl Editor { self.pasting_board = None; return; } - if self.mouse.pos().y < footer_top && self.mouse.pos().y > HEADER_HEIGHT as f32 { + if self.mouse.pos().y < footer_top && self.mouse.pos().y > HEADER_HEIGHT { let view_offset = Vec2::new( self.view_offset.x.rem(tile_size), self.view_offset.y.rem(tile_size), @@ -1399,7 +1399,7 @@ impl Editor { } } } - if self.mouse.pos().y < footer_top && self.mouse.pos().y > HEADER_HEIGHT as f32 { + if self.mouse.pos().y < footer_top && self.mouse.pos().y > HEADER_HEIGHT { let tile_pos = (self.mouse.pos() - self.view_offset) / tile_size; let tile_pos = Vec2::new(tile_pos.x.floor(), tile_pos.y.floor()); @@ -1460,7 +1460,7 @@ impl Editor { } } Tool::Blueprint => { - if self.mouse.pos().x > SIDEBAR_WIDTH as f32 { + if self.mouse.pos().x > SIDEBAR_WIDTH { if let Some(bp) = self.blueprints.get(self.selected_blueprint) { self.set_area(pos, bp.board.clone()); } @@ -1502,7 +1502,7 @@ impl Editor { .draw(&globals.textures, offset, self.zoom, false); bp.board.draw_comments(offset, self.zoom); } - if self.mouse.pos().x < SIDEBAR_WIDTH as f32 { + if self.mouse.pos().x < SIDEBAR_WIDTH { if self.mouse.scroll() == Some(Scroll::Down) && self.blueprint_scroll < self.blueprints.len().saturating_sub(5) { diff --git a/src/main.rs b/src/main.rs index 2ad03e4..0e7c26f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -147,7 +147,7 @@ impl Game { .sum::() .saturating_sub(fit_on_screen) as f32 * ENTRY_SPACING; - if self.globals.mouse.pos().x < level_list_width as f32 { + if self.globals.mouse.pos().x < level_list_width { if self.globals.mouse.scroll() == Some(Scroll::Down) && self.level_scroll < max_scroll { self.level_scroll += ENTRY_SPACING; } @@ -310,7 +310,7 @@ impl Game { if let Some(solution) = solutions.get_mut(self.selected_solution) { let column_x = level_list_width + entry_width + 56.; - let bounds = Rect::new(column_x as f32, y as f32, 220., 30.); + let bounds = Rect::new(column_x, y, 220., 30.); if text_input( &mut self.globals, bounds, diff --git a/src/ui.rs b/src/ui.rs index 90a6902..c5b461c 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -86,7 +86,7 @@ impl ShapedText { // draw_rectangle(x, y, self.max_width, 4, Color::RED); for (i, line) in self.lines.iter().enumerate() { let line = &self.text[line.clone()]; - let line_y = y + self.font_size as f32 * i as f32; + let line_y = y + self.font_size * i as f32; draw_text(line, x, line_y, self.font_size, colors::WHITE); } } @@ -344,7 +344,7 @@ pub fn draw_usize( while (number != 0 || i == 0) && i < digits { let texture = textures.get(&format!("digit_{}", number % 10)); let x = x + (digits - i - 1) as f32 * 10. * scale; - draw_scaled_texture(texture, x, y, scale as f32); + draw_scaled_texture(texture, x, y, scale); number /= 10; i += 1; }