diff --git a/include/Cubed/ui/chat_box.hpp b/include/Cubed/ui/chat_box.hpp index 17ac318..1fef375 100644 --- a/include/Cubed/ui/chat_box.hpp +++ b/include/Cubed/ui/chat_box.hpp @@ -24,9 +24,8 @@ public: std::string& get_input_text(); float width() const override; float height() const override; - void set_d_image(TextureManager& m); + void set_text_field(std::unique_ptr text_field); void set_typing(bool typing, bool finished); - void set_app(App* app); template ChatBox& set_on_finish(F&& f) { m_text_field->set_on_finish(std::forward(f)); return *this; diff --git a/include/Cubed/ui/default_image.hpp b/include/Cubed/ui/default_image.hpp new file mode 100644 index 0000000..3fbd870 --- /dev/null +++ b/include/Cubed/ui/default_image.hpp @@ -0,0 +1,5 @@ +#pragma once +namespace Cubed { +static constexpr const char* DEFAULT_TEXT_FIELD_IMAGE = + "texture/ui/textfield001.png"; +} \ No newline at end of file diff --git a/include/Cubed/ui/text_field.hpp b/include/Cubed/ui/text_field.hpp index 9eb332a..90f09bd 100644 --- a/include/Cubed/ui/text_field.hpp +++ b/include/Cubed/ui/text_field.hpp @@ -1,6 +1,5 @@ #pragma once -#include "Cubed/ui/image.hpp" #include "Cubed/ui/label.hpp" #include "Cubed/ui/rect.hpp" #include "Cubed/ui/widget.hpp" @@ -22,13 +21,13 @@ public: TextField& set_width(float width); TextField& set_height(float height); TextField& set_show_text(const std::string& text); - TextField& set_background_image(const std::string& path, - TextureManager& texture_manager); - TextField& set_default_image(TextureManager& texture_manager); + TextField& set_background(std::unique_ptr background); TextField& set_auto_scale(bool auto_scale); TextField& set_app(App* app); TextField& set_typing(bool typing, bool finished); TextField& clear_input(); + TextField& set_fill_width(bool fill); + TextField& set_fill_height(bool fill); bool handle_mouse_move_event(const MouseMoveEvent& e) override; bool handle_mouse_button_event(const MouseButtonEvent& e) override; bool handle_text_input_event(const TextInputEvent& e) override; @@ -46,11 +45,9 @@ private: static constexpr float DEFAULT_SCALE = 3.0f; static constexpr float TEXT_SCALE = 0.6f; static constexpr float CURSOR_INTERVAL = 0.5f; - static constexpr const char* DEFAULT_TEXT_FIELD_IMAGE = - "texture/ui/textfield001.png"; App* m_app = nullptr; - std::unique_ptr m_background; + std::unique_ptr m_background; std::unique_ptr