#pragma once #include "Widget.hpp" #include namespace tp { class LabelWidget : public Widget { public: LabelWidget() = default; void setText(const std::string& text); [[nodiscard]] const std::string& getText() const; void draw(Canvas& canvas) override; [[nodiscard]] bool isPassThroughEvents() const override { return true; } private: std::string mText = "Text"; halnf mPadding = 5; RGBA mColor = 1.f; halnf mSize = 17.f; }; class ButtonWidget : public LabelWidget { public: ButtonWidget(); void setAction(const std::function& action); void process(const EventHandler& eventHandler) override; void draw(Canvas& canvas) override; [[nodiscard]] bool isPassThroughEvents() const override { return false; } [[nodiscard]] bool needUpdate() const override; void finishAnimations() override; private: std::function mAction; SpringRect mColorAnimated; halnf mRounding = 5; RGBA mColor = { 1.0f, 0.0f, 0.0f, 1.f }; RGBA mColorHovered = { 0.0f, 0.0f, 0.0f, 1.f }; }; }