From b9f76bb4864b446e4101f15b860ec1b8d2d9457b Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sun, 22 Dec 2024 21:04:27 +0100 Subject: [PATCH] replace text buttons for exit and save with icon buttons --- assets/exit.png | Bin 0 -> 152 bytes src/editor.rs | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 assets/exit.png diff --git a/assets/exit.png b/assets/exit.png new file mode 100644 index 0000000000000000000000000000000000000000..2dca7a52ec03967eed822ed8d0ab29b37af83263 GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`@t!V@Ar`$ygD-M1C~{n0{QrOI zdryIAD}xiugUrlzCnm0tKXYc=qE*jg`tnyLY>bUfTo=qW!FHBH)5Kkq7BF`=NGcfY zvVQni_XuB4Ymg($T(gT&FFaOAhWP*b8!vI3Klp}@Y8vM?8=zGTp00i_>zopr0H8`X A&;S4c literal 0 HcmV?d00001 diff --git a/src/editor.rs b/src/editor.rs index bacdfa3..7f116ff 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -675,23 +675,27 @@ impl Editor { ); if self.exit_menu { - if simple_button(d, 5, 5, 75, 30) { - self.exit_menu = false; - } - d.draw_text("cancel", 10, 10, 20, Color::WHITE); - if simple_button(d, 85, 5, 60, 30) { + if simple_button(d, 4, 4, 32, 32) { self.exit_state = ExitState::ExitAndSave; } - d.draw_text("exit", 90, 10, 20, Color::WHITE); + self.tooltip.add(4, 4, 32, 32, "exit"); + draw_scaled_texture(d, textures.get("exit"), 4, 4, 2.); + if simple_button(d, 38, 4, 32, 32) { + self.exit_menu = false; + } + draw_scaled_texture(d, textures.get("cancel"), 38, 4, 2.); + self.tooltip.add(38, 4, 32, 32, "cancel"); } else { - if simple_button(d, 5, 5, 75, 30) { + if simple_button(d, 4, 4, 32, 32) { self.exit_menu = true; } - d.draw_text("exit", 10, 10, 20, Color::WHITE); - if simple_button(d, 85, 5, 60, 30) { + self.tooltip.add(4, 4, 32, 32, "exit"); + draw_scaled_texture(d, textures.get("exit"), 4, 4, 2.); + if simple_button(d, 38, 4, 32, 32) { self.exit_state = ExitState::Save; } - d.draw_text("save", 90, 10, 20, Color::WHITE); + draw_scaled_texture(d, textures.get("save"), 38, 4, 2.); + self.tooltip.add(38, 4, 32, 32, "save"); } if self.sim_state == SimState::Editing {