#pragma once #include #include #include "imgui.h" #include "imgui_internal.h" struct TipLine { bool has_marker = false; ImU32 marker = 0; std::string name; std::string bold; std::string rest; }; class TipLabel { public: void showText(const ImVec2 &pt, const std::vector &text, const ImRect &rect); void hide() { visible_ = false; } bool isVisible() const { return visible_; } void draw(); private: ImVec2 layoutLines(ImDrawList *p, const ImVec2 &origin, ImU32 fg) const; ImVec2 sizeHint() const; static constexpr float MARGIN = 2.0f; std::vector text_; ImVec2 pos_; ImVec2 size_; bool visible_ = false; };