From 234746babb7a1adc8281bf24fd1fbe0f26b18340 Mon Sep 17 00:00:00 2001 From: zhenyan121 <3367366583@qq.com> Date: Tue, 21 Jul 2026 19:51:04 +0800 Subject: [PATCH] feat(ui): add item slot tooltip and make window size static --- include/Cubed/ui/anchor.hpp | 3 +++ include/Cubed/ui/item_slot.hpp | 5 ++++ include/Cubed/ui/widget.hpp | 7 ++--- src/app.cpp | 2 +- src/debug_collector.cpp | 3 +-- src/ui/credits_ui.cpp | 2 -- src/ui/error_ui.cpp | 2 -- src/ui/host_game_ui.cpp | 2 -- src/ui/inventory_ui.cpp | 4 +-- src/ui/item_slot.cpp | 45 ++++++++++++++++++++++++++++++++ src/ui/join_game_ui.cpp | 2 -- src/ui/main_menu_ui_manager.cpp | 4 --- src/ui/pause_menu_ui_manager.cpp | 3 --- src/ui/settings_ui.cpp | 2 -- src/ui/widget.cpp | 18 +++++++++---- src/ui/world_ui_manager.cpp | 3 --- 16 files changed, 73 insertions(+), 34 deletions(-) diff --git a/include/Cubed/ui/anchor.hpp b/include/Cubed/ui/anchor.hpp index 95fd298..4040a60 100644 --- a/include/Cubed/ui/anchor.hpp +++ b/include/Cubed/ui/anchor.hpp @@ -12,4 +12,7 @@ enum class Anchor { BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, + + FOLLOW_MOUSE + }; \ No newline at end of file diff --git a/include/Cubed/ui/item_slot.hpp b/include/Cubed/ui/item_slot.hpp index bb21ed2..50b4138 100644 --- a/include/Cubed/ui/item_slot.hpp +++ b/include/Cubed/ui/item_slot.hpp @@ -2,6 +2,7 @@ #include "Cubed/gameplay/block.hpp" #include "Cubed/ui/image.hpp" +#include "Cubed/ui/label.hpp" #include "Cubed/ui/widget.hpp" namespace Cubed { class TextureManager; @@ -21,9 +22,13 @@ private: static constexpr const char* DEFAULT_SLOT_PATH = "texture/ui/slot.png"; void on_render(Renderer& renderer) override; void on_update(float dt) override; + bool handle_mouse_move_event(const MouseMoveEvent& e) override; + bool handle_window_resize_event(const WindowResizeEvent& e) override; std::unique_ptr m_background; std::unique_ptr m_foreground; + std::unique_ptr