From 94d3989e0a5412a54e182c5944ca07bdafeedbd2 Mon Sep 17 00:00:00 2001 From: zhenyan121 <3367366583@qq.com> Date: Wed, 15 Jul 2026 15:47:20 +0800 Subject: [PATCH] feat(ui): add button enable/disable and reset on re-enter Prevent double-clicking on buttons that push new scenes by disabling them on click and re-enabling when the UI manager's on_re_enter is called. --- include/Cubed/ui/button.hpp | 3 ++- include/Cubed/ui/main_menu_ui_manager.hpp | 3 +++ include/Cubed/ui/pasue_menu_ui_manager.hpp | 3 +++ src/scene/main_menu_scene.cpp | 1 + src/scene/world_scene.cpp | 1 + src/ui/button.cpp | 19 ++++++++++++------- src/ui/main_menu_ui_manager.cpp | 18 +++++++++++++++--- src/ui/pause_menu_ui_manager.cpp | 17 +++++++++++++---- 8 files changed, 50 insertions(+), 15 deletions(-) diff --git a/include/Cubed/ui/button.hpp b/include/Cubed/ui/button.hpp index 46913e0..1984771 100644 --- a/include/Cubed/ui/button.hpp +++ b/include/Cubed/ui/button.hpp @@ -31,7 +31,7 @@ public: Button& set_text(const std::string& text); Button& set_auto_scale(bool auto_scale); - + Button& set_enable(bool enable); float scale() const; template Button& set_clicked(F&& f) { m_clicked = std::forward(f); @@ -49,6 +49,7 @@ private: std::unique_ptr m_background; std::unique_ptr