#pragma once #include "../RoundedRectangle.hpp" #include #include namespace sf { class Event; class Font; class RenderTarget; class Shader; } namespace QuickMedia { enum ButtonEvent { BUTTON_EVENT_NONE = 0, BUTTON_EVENT_CLICKED = 1 }; class Button { public: Button(const std::string &label, sf::Font *font, unsigned int character_size, float width, sf::Shader *rounded_rectangle_shader, float scale = 1.0f); ButtonEvent on_event(sf::Event &event); void draw(sf::RenderTarget &target); void set_background_color(sf::Color color); void set_position(sf::Vector2f pos); sf::Vector2f get_position() const; float get_width() const; float get_height() const; private: sf::Text label; RoundedRectangle background; sf::Color background_color; float scale; bool clicked_inside = false; }; }