show solution id under name
This commit is contained in:
parent
1df323e7ac
commit
040b3d3779
3 changed files with 9 additions and 10 deletions
14
src/main.rs
14
src/main.rs
|
@ -201,12 +201,8 @@ impl Game {
|
|||
);
|
||||
|
||||
if let Some(solution) = solutions.get_mut(self.selected_solution) {
|
||||
let bounds = Rectangle {
|
||||
x: (level_list_width + 10 + entry_width + 10) as f32,
|
||||
y: y as f32,
|
||||
width: 220.,
|
||||
height: 30.,
|
||||
};
|
||||
let column_x = level_list_width + entry_width + 20;
|
||||
let bounds = Rectangle::new(column_x as f32, y as f32, 220., 30.);
|
||||
text_input(
|
||||
d,
|
||||
bounds,
|
||||
|
@ -214,12 +210,12 @@ impl Game {
|
|||
&mut self.editing_solution_name,
|
||||
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, button_x, y + 40, 220, 30) {
|
||||
if simple_button(d, column_x, y + 50, 220, 30) {
|
||||
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 {
|
||||
self.solutions.insert(level.id().to_owned(), Vec::new());
|
||||
|
|
|
@ -295,7 +295,6 @@ impl Board {
|
|||
}
|
||||
}
|
||||
}
|
||||
dbg!(&out);
|
||||
out
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,10 @@ impl Solution {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn id(&self) -> &str {
|
||||
&self.solution_id
|
||||
}
|
||||
|
||||
pub fn save(&self) {
|
||||
let dir = userdata_dir().join("solutions").join(&self.level_id);
|
||||
fs::create_dir_all(&dir).unwrap();
|
||||
|
|
Loading…
Reference in a new issue