diff --git a/assets/texture/ui/button001.png b/assets/texture/ui/button001.png index d235658..0a8bd3e 100644 Binary files a/assets/texture/ui/button001.png and b/assets/texture/ui/button001.png differ diff --git a/include/Cubed/ui/button.hpp b/include/Cubed/ui/button.hpp index 15d226e..324ea29 100644 --- a/include/Cubed/ui/button.hpp +++ b/include/Cubed/ui/button.hpp @@ -18,41 +18,35 @@ public: bool handle_mouse_move_event(const MouseMoveEvent& e) override; bool handle_mouse_button_event(const MouseButtonEvent& e) override; - void set_window_size(int width, int height) override; Button& set_scale(float scale); - Widget& set_anchor(Anchor anchor) override; - Widget& set_offset(glm::ivec2 offset) override; - glm::vec2 pos() const override; + float width() const override; float height() const override; + + Button& set_width(float width); + Button& set_height(float height); + Button& set_background_image(const std::string& path, + TextureManager& texture_manager); + Button& set_text(const std::string& text); + float scale() const; template Button& set_clicked(F&& f) { m_clicked = std::forward(f); return *this; } - template T& set_background(Args&&... args) { - auto w = std::make_unique(std::forward(args)..., m_parent); - T& ref = *w; - m_background = std::move(w); - return ref; - } - - template T& set_foreground(Args&&... args) { - auto w = std::make_unique(std::forward(args)..., this); - T& ref = *w; - m_foreground = std::move(w); - m_foreground->set_anchor(Anchor::CENTER); - return ref; - } - private: + static constexpr float PADDING = 5.0f; + static constexpr float DEFAULT_SCALE = 3.0f; std::function m_clicked; std::unique_ptr m_background; std::unique_ptr