#pragma once #include #include #include #include #include namespace Game::Object { class UITextBox : public Entity { public: UITextBox(const std::string& name, std::shared_ptr font, const Transform& transform, float x = 0.f, float y = 0.f); ~UITextBox() override = default; void start() override; void update(float deltaTime) override; void setText(const std::string& text); std::string getText() const; std::string getValue() const; bool isFocused() const; void setPosition(float x, float y) { mX = x; mY = y; } std::pair getPosition() const { return {mX, mY}; } private: bool isMouseInsideBox() const; void refreshVisualText(); float mX, mY; std::string mText; bool mIsFocused = false; float mBoxWidth = 0.f; float mBoxHeight = 0.f; bool mNeedsTextRefresh = true; }; }