This commit is contained in:
Crispy 2024-12-24 23:32:25 +01:00
parent f35ca28c02
commit 74d142191c
2 changed files with 6 additions and 11 deletions

View file

@ -1024,8 +1024,7 @@ impl Editor {
|(row, col): (i32, i32), texture: &str, tooltip: &'static str, tool_option: Tool| {
let border = 4.;
let gap = 2.;
let tex_size = 32.;
let button_size = tex_size + border * 2.;
let button_size = 32. + border * 2.;
let grid_size = button_size + gap * 2.;
let pos = Vector2 {
x: 100. + col as f32 * grid_size - if col < 0 { 10. } else { 0. },
@ -1036,13 +1035,11 @@ impl Editor {
tooltip,
);
scrollable_texture_option_button(
d,
&self.mouse,
(d, &self.mouse),
pos,
textures.get(texture),
tool_option,
&mut self.active_tool,
tex_size,
border,
)
};

View file

@ -299,13 +299,11 @@ pub fn text_input(
}
pub fn scrollable_texture_option_button<T>(
d: &mut RaylibDrawHandle,
mouse: &MouseInput,
(d, mouse): (&mut RaylibDrawHandle, &MouseInput),
pos: Vector2,
texture: &Texture2D,
option: T,
current: &mut T,
tex_size: f32,
border: f32,
) -> Option<Scroll>
where
@ -314,8 +312,8 @@ where
let bounds = Rectangle {
x: pos.x,
y: pos.y,
width: tex_size + border * 2.,
height: tex_size + border * 2.,
width: 32. + border * 2.,
height: 32. + border * 2.,
};
d.draw_rectangle_rec(
bounds,
@ -329,7 +327,7 @@ where
texture,
pos + Vector2::new(border, border),
0.,
tex_size / texture.width as f32,
32. / texture.width as f32,
Color::WHITE,
);
if mouse.is_over(bounds) {