re-style text input
This commit is contained in:
parent
f30e42cb31
commit
08801367ba
1 changed files with 13 additions and 14 deletions
27
src/util.rs
27
src/util.rs
|
@ -92,13 +92,21 @@ pub fn text_input(
|
|||
is_selected: &mut bool,
|
||||
) -> bool {
|
||||
let mut changed = false;
|
||||
let (bg, border) = if *is_selected {
|
||||
let (bg, underline) = if *is_selected {
|
||||
(Color::DARKCYAN, Color::CYAN)
|
||||
} else {
|
||||
(Color::GRAY, Color::DIMGRAY)
|
||||
};
|
||||
d.draw_rectangle_rec(bounds, border);
|
||||
d.draw_rectangle_rec(shrink_rec(bounds, 2.), bg);
|
||||
d.draw_rectangle_rec(bounds, 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 {
|
||||
&format!("{text}_")
|
||||
} else {
|
||||
|
@ -180,15 +188,6 @@ pub fn texture_option_button<T>(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn shrink_rec(rec: Rectangle, a: f32) -> Rectangle {
|
||||
Rectangle {
|
||||
x: rec.x + a,
|
||||
y: rec.y + a,
|
||||
width: rec.width - a * 2.,
|
||||
height: rec.height - a * 2.,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn userdata_dir()->PathBuf{
|
||||
pub fn userdata_dir() -> PathBuf {
|
||||
PathBuf::from("user")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue