re-style text input

This commit is contained in:
Crispy 2024-10-06 20:39:46 +02:00
parent f30e42cb31
commit 08801367ba

View file

@ -92,13 +92,21 @@ pub fn text_input(
is_selected: &mut bool, is_selected: &mut bool,
) -> bool { ) -> bool {
let mut changed = false; let mut changed = false;
let (bg, border) = if *is_selected { let (bg, underline) = if *is_selected {
(Color::DARKCYAN, Color::CYAN) (Color::DARKCYAN, Color::CYAN)
} else { } else {
(Color::GRAY, Color::DIMGRAY) (Color::GRAY, Color::DIMGRAY)
}; };
d.draw_rectangle_rec(bounds, border); d.draw_rectangle_rec(bounds, bg);
d.draw_rectangle_rec(shrink_rec(bounds, 2.), bg); d.draw_rectangle_rec(
Rectangle::new(
bounds.x + 2.,
bounds.y + bounds.height - 5.,
bounds.width - 4.,
3.,
),
underline,
);
let drawn_text = if *is_selected { let drawn_text = if *is_selected {
&format!("{text}_") &format!("{text}_")
} else { } else {
@ -180,15 +188,6 @@ pub fn texture_option_button<T>(
} }
} }
pub fn shrink_rec(rec: Rectangle, a: f32) -> Rectangle { pub fn userdata_dir() -> PathBuf {
Rectangle {
x: rec.x + a,
y: rec.y + a,
width: rec.width - a * 2.,
height: rec.height - a * 2.,
}
}
pub fn userdata_dir()->PathBuf{
PathBuf::from("user") PathBuf::from("user")
} }