show solution id under name

This commit is contained in:
Crispy 2024-10-07 18:43:24 +02:00
parent 1df323e7ac
commit 040b3d3779
3 changed files with 9 additions and 10 deletions

View file

@ -201,12 +201,8 @@ impl Game {
); );
if let Some(solution) = solutions.get_mut(self.selected_solution) { if let Some(solution) = solutions.get_mut(self.selected_solution) {
let bounds = Rectangle { let column_x = level_list_width + entry_width + 20;
x: (level_list_width + 10 + entry_width + 10) as f32, let bounds = Rectangle::new(column_x as f32, y as f32, 220., 30.);
y: y as f32,
width: 220.,
height: 30.,
};
text_input( text_input(
d, d,
bounds, bounds,
@ -214,12 +210,12 @@ impl Game {
&mut self.editing_solution_name, &mut self.editing_solution_name,
true, true,
); );
d.draw_text(solution.id(), column_x, y + 35, 10, Color::GRAY);
let button_x = level_list_width + entry_width + 20; if simple_button(d, column_x, y + 50, 220, 30) {
if simple_button(d, button_x, y + 40, 220, 30) {
self.open_editor = Some(Editor::new(solution.clone(), level.clone())); self.open_editor = Some(Editor::new(solution.clone(), level.clone()));
} }
d.draw_text("edit", button_x + 5, y + 45, 20, Color::WHITE); d.draw_text("edit", column_x + 5, y + 55, 20, Color::WHITE);
} }
} else { } else {
self.solutions.insert(level.id().to_owned(), Vec::new()); self.solutions.insert(level.id().to_owned(), Vec::new());

View file

@ -295,7 +295,6 @@ impl Board {
} }
} }
} }
dbg!(&out);
out out
} }

View file

@ -35,6 +35,10 @@ impl Solution {
} }
} }
pub fn id(&self) -> &str {
&self.solution_id
}
pub fn save(&self) { pub fn save(&self) {
let dir = userdata_dir().join("solutions").join(&self.level_id); let dir = userdata_dir().join("solutions").join(&self.level_id);
fs::create_dir_all(&dir).unwrap(); fs::create_dir_all(&dir).unwrap();